我有一个带有一组字段集的表单。这些字段集将有条件地隐藏并显示在服务器端,因此我需要这些字段集从左到右从上到下流动。下面的代码实现了这一点,但是 10px 的 margin-bottom 没有被 IE 接受(仅测试过 IE7)。
我读过一些帖子,建议这与边距折叠有关,如果你不添加填充,但我试过了,同样的事情发生了。如何在 2 行字段集之间创建 10px 的空间?
<html>
<head>
<style>
fieldset {
display: inline-block;
width: 30%;
height:90px;
vertical-align: top;
border: 1px solid black;
margin-bottom:10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<label>Label:</label>
<input type="text"/>
</fieldset>
<fieldset>
<label>Label:</label>
<input type="text"/>
</fieldset>
<fieldset>
<label>Label:</label>
<input type="text"/>
</fieldset>
<fieldset>
<label>Label:</label>
<input type="text"/>
</fieldset>
<fieldset>
<label>Label:</label>
<input type="text"/>
</fieldset>
</form>
</body>
最佳答案
对于 IE 6 和 7,
display: inline;
zoom: 1;
在 block 级元素上等同于 inline-block
因为 zoom
触发 IE 的 hasLayout
属性(阅读更多关于它的信息 here )
关于css - IE 不接受边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1198743/