我在 HTML 页面中有一个表单,在除 IE 之外的所有浏览器中都能正常工作。我知道它与 IE 渲染 fieldset 标记有关,并且我尝试使用伪 div 来破解它,但这没有用。有人遇到过这个或有解决方法吗?
这是一个小提琴: http: //jsfiddle.net/G9NSx/&
这里是代码:
<form>
<fieldset>
<ol>
<li>
<label for="name">Name<em> *</em></label>
<input id="name" />
</li>
<li>
<label for="company">Company Name</label>
<input id="company" />
</li>
<li>
<label for="address">Address</label>
<input id="address" />
</li>
<li>
<label for="city">City</label>
<input id="city" />
</li>
<li>
<label for="state">State/Providence</label>
<input id="state" />
</li>
<li>
<label for="country">Country</label>
<input id="country" />
</li>
<li>
<label for="phone">Phone<em> *</em></label>
<input id="phone" />
</li>
<li>
<label for="fax">Fax</label>
<input id="fax" />
</li>
<li>
<label for="email">Email</label>
<input id="email" />
</li>
<li>
<fieldset class="regarding">
<legend>Regarding:<em> *</em></legend>
<label><input type="radio" name="regarding" /> Capabilities</label>
<label><input type="radio" name="regarding" /> Testing Information</label>
<label><input type="radio" name="regarding" /> Business Relations</label>
<label><input type="radio" name="regarding" /> Other</label>
</fieldset>
</li>
<li>
<label for="add-info">Additional Info.</label><br />
<textarea name="add-info"></TEXTAREA>
</li>
</ol>
<input type="submit" value="Submit"> <input type="reset" value="Reset"/><br />
<br />
<span class="bold">Required Fields<em> *</em></span>
</fieldset>
</form>
CSS:
form {
border: 1px solid #0066FF;
/*background-image: url(../images/form-bg.jpg);*/
background-color: #FFF;
}
form fieldset {
margin: 10px;
padding: 20px;
}
form legend {
padding: 0 2px;
font-weight: bold;
}
form label {
display: inline-block;
line-height: 1.8;
vertical-align: top;
}
form fieldset ol {
margin: 0;
padding: 0;
}
form fieldset li {
list-style: none;
padding: 5px;
margin: 0;
}
form fieldset li textarea {
min-width: 300px;
max-width: 500px;
}
form fieldset fieldset {
border: none;
margin: 3px 0 0;
}
form fieldset fieldset legend {
padding: 0 0 5px;
font-weight: normal;
}
form fieldset fieldset label {
display: block;
width: auto;
}
form em {
font-weight: bold;
font-style: normal;
color: #0066FF;
}
form label {
width: 120px; /* Width of labels */
}
form fieldset fieldset label {
margin-left: 123px; /* Width plus 3 (html space) */
}
form fieldset ol li fieldset.regarding {
padding: 0px;
}
这是我在 IE9 中遇到的问题的屏幕截图