不加入br这一行,在FIREFOX中id1的margin-top:20px将会在d0上作用,使d0上方与body间有20px的间距,d1与d0的上方没有间距,而IE内正常显示。代码如下:


 
<body style="margin:0;height:0;">
    <div id="d0" style="background-color:#333333;height:500px;">
        <br style="line-height:0;"/>
        <div id="d1" style="background-color:#000000;margin-top:20px;height:100px;"></div>
        <div id="d2" style="background-color:#000000;margin-top:20px;height:100px;"></div>
    </div>
</body>

或者在id0上加一个清除浮动就能解决.

posted on 2011-09-27 00:10  逝去的平衡  阅读(749)  评论(0编辑  收藏  举报