【发布时间】:2010-11-17 18:29:29
【问题描述】:
编辑:这只发生在 IE8 中,它在 IE7、Firefox、Opera 等中运行良好
首先,这是我在photoshop中制作的一张图片来展示我的问题:http://richardknop.com/pict.jpg
现在你应该知道我的问题了。这是我正在使用的标记的简化版本(我省略了最不相关的内容):
<div class="left">
<div class="box">
// box content
</div>
<div class="box">
// box content
</div>
<div class="box">
// box content
</div>
</div>
<div class="right">
<div class="box">
// box content
</div>
<div class="box">
// box content
</div>
<div class="box">
// box content
</div>
</div>
<div class="clear"></div>
<div class="box">
//
// NOW THIS BOX HAS NO TOP MARGIN
//
</div>
<div class="box">
// box content
</div>
CSS 样式是这样的:
.clear {
clear: both;
}
.left {
float: left;
}
.right {
float: right;
}
.box {
overflow: auto;
margin-top: 10px;
}
很明显,我忽略了所有不相关的样式,如边框、背景颜色和图像、字体大小等。我只保留了重要的东西。
知道问题出在哪里吗?
【问题讨论】:
-
您是否设置了 DOCTYPE(例如,您是在 IE8 标准模式下运行的吗?还是怪癖?)
-
是的,我有:ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" rel="nofollow" target="_blank">w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
我没有详细查看您的问题,但想知道这是否可能是由于边距折叠引起的,例如andybudd.com/archives/2003/11/no_margin_for_error
标签: html css internet-explorer xhtml margin