我正在尝试使用字段集图例作为一组单选按钮的标签。我的HTML和CSS在IE8和9、firefox和chrome上都运行得很好。在IE7中,标签显示在单选按钮上。在所有其他浏览器中,标签显示在按钮的左侧。我很乐意为IE7添加一个有条件的stle,但我不知道是什么让它工作。
该问题在以下标记中重复出现
<!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>发布于 2011-11-16 22:48:56
如果您希望ie7有条件,则执行以下操作:
CSS
.radiolegend {
float: left; width: 150px;
}
.fieldsetstyle {
border: 0 none; clear: left; float: left; width:300px;
}
.cb{
float:right;
margin-top:-20px;
}HTML
<form>
<fieldset class="fieldsetstyle">
<legend class="radiolegend">legend</legend>
<div class="cb"><input type="radio" name="r1" style="display: inline;"/>r1</div>
<div class="cb"> <input type="radio" name="r2" style="display: inline;"/>r2 </div>
</fieldset></form>现在,您还需要更改其余浏览器的样式。只需从.cb中删除margin-top:-20px;即可。您在<input>标记中对文本进行换行,这是不正确的。<input>必须是自动关闭的
https://stackoverflow.com/questions/8152212
复制相似问题