以下代码在除 IE 之外的所有浏览器中都能正常工作。输入的宽度为 300 像素,但在 IE 中,只有在聚焦时才会获得正确的大小。我也尝试了 max-width 和 min-width ,但它似乎不起作用。我附上一张图片,您可以看到非活动输入更大:
http://kepfeltoltes.hu/131104/IE_www.kepfeltoltes.hu_.jpg
这是代码和小提琴:HTML:
<div id="label">
<form action="" method="post">
<label for="name">
<input class="input1" type="text" placeholder="Your name" name="name" id="name" />
</label>
<label for="E-mail">
<input class="input1" type="text" placeholder="Your e-mail" id="email"/>
</label>
<label for="Subject">
<input class="input1" type="text" placeholder="Subject" id="subject" />
</label>
<label for="Message">
<textarea class="input2" name="message" rows="20" cols="20" id="message" placeholder="Message"></textarea>
</label>
<label>
</form>
CSS:
#label {
width:960px;
height:600px;
}
input {
width:300px;
max-width:300px;
min-width:300px;
-moz-border-color: #0d1025;
-moz-border-width:medium;
border-color: #0d1025;
border-width:medium;
margin-top: 15px;
border-style:solid;
}
.input1 {
width:300px;
max-width:300px;
height:30px;
display:block;
}
.input2 {
width:650px;
max-width:650px;
max-height:270px;
height:270px;
margin-left:320px;
margin-top:-144px;
border-color: #0d1025;
border-width:medium;
border-style: solid;
}
::-webkit-input-placeholder {
color: #0d1025;
font-style:italic;
padding-left:15px;
font-weight:bold;
}
:-moz-placeholder { /* Firefox 18- */
color: #0d1025;
font-style:italic;
padding-left:15px;
font-weight:bold;
}
::-moz-placeholder { /* Firefox 19+ */
color: #0d1025;
font-style:italic;
padding-left:15px;
font-weight:bold;
}
:-ms-input-placeholder {
color: #0d1025;
font-style:italic;
padding-left:15px;
font-weight:bold;
}
input:focus {
outline: none !important;
border-color:#009bcf;
/*box-shadow: 0 0 5px #009bcf;*/
}
textarea:focus {
outline: none !important;
border-color:#009bcf;
}
小提琴:
http://jsfiddle.net/h2core/hLxf6/
我做错了什么?谢谢你的帮助!