html css常识

Firefox,IE8中margin-top的bug及解决办法 

在Firefox,IE8这两个浏览器中,有两个嵌套关系的div,如果外层div的父元素padding值为0,那么内层div的margin-top或者margin-bottom的值会“转移”给外层div。 
a中有b 
在B前面插入一个非空的元素<div style="height:0px">&nbsp;</div>,命名为C。结构为 
<div id="a"> 
<div style="height:0px">&nbsp;</div> 
<div id="b"><!-- content --></div> 
</div> 

posted @ 2015-11-16 13:14  风很大  阅读(110)  评论(0)    收藏  举报