关于 ie6 float 塌陷

网上有很多关于浮动塌陷的文章。

 自己一般是用,父标签的overflo:hidden解决这一个问题的,后来遇上ie6的浏览器overflow:hidden不起作用了。

对overflow使用hack也不管用。

最后解决ie6下需对父标签定义款宽度(width:100%)的情况下在使用overflow:hidden.

浮动就能解决完美解决。唯一的缺憾就是使用了overflow:hidden

 

 

网上有专门解决浮动的css  clear-fix类,通过伪类实现模仿多余的插入块级元素的效果,现在一般都用这种方法了。

.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

 

posted @ 2012-03-09 11:00  break_happy  Views(275)  Comments(0)    收藏  举报