ie7中fieldset的布局不一致
我正在尝试使用字段集图例作为一组单选按钮的标签。我的 HTML 和 CSS 在 IE8&9、firefox 和 chrome 中运行良好。在 IE7 中,标签出现在单选按钮上方。在所有其他浏览器中,标签显示在按钮的左侧。我很高兴为 IE7 添加一个条件样式,但我不知道什么可以使这个工作。
该问题在以下标记中重复出现
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
.radiolegend {
display: inline; float: left; width: 300px;
}
.fieldsetstyle {
border: 0 none; clear: left; float: left;
}
</style>
</head>
<body>
<form>
<fieldset class="fieldsetstyle">
<legend class="radiolegend">legend</legend>
<input type="radio" name="r1" style="display: inline;" id="r1">
<label for="r1">r1</label>
<input type="radio" name="r2" style="display: inline;" id="r2">
<label for="r2">r2</label>
</fieldset>
</form>
</body>
</html>
I am trying to use a fieldset legend as a label for a group of radio buttons. The HTML and CSS I have works fine in IE8&9, firefox and chrome. In IE7 the label appears over the radio buttons. In all other browsers the label appears to the left of the buttons. I am happy to add a conditional stle for IE7 but I cant figure out what would make this work.
The problem is replicated in the following markup
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
.radiolegend {
display: inline; float: left; width: 300px;
}
.fieldsetstyle {
border: 0 none; clear: left; float: left;
}
</style>
</head>
<body>
<form>
<fieldset class="fieldsetstyle">
<legend class="radiolegend">legend</legend>
<input type="radio" name="r1" style="display: inline;" id="r1">
<label for="r1">r1</label>
<input type="radio" name="r2" style="display: inline;" id="r2">
<label for="r2">r2</label>
</fieldset>
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要 ie7 有条件,请执行以下操作:
CSS
HTML
现在,您还需要更改其余浏览器的样式。只需从
.cb
中删除margin-top:-20px;
即可。您将文本包装在标记中,这是不正确的。
必须自动关闭
If you want ie7 conditional, then do this:
CSS
HTML
Now, you need to change styling for the rest of the browsers too. Just remove
margin-top:-20px;
from.cb
. You were wrapping text in<input>
tag, it's not correct.<input>
has to be self closing