在一个common.css中发现了3中清除浮动,
他们有什么区别吗?
.clearfix{zoom:1; overflow:hidden;}
.clear{ clear:both; font-size:0; height:0; line-height:0;overflow:hidden}
.row {zoom: 1;}
.row:after {content: "";display: table;clear: both;}
我遇到子元素有浮动的情况,都是使用这段代码。
.clearfix:after{
content:"";
dispaly:block;
clear:both;
}
.clearfix{
zoom:1;
}
还是说不同情况不同对待?
第二种用得比较多。
如果用overflow:hidden;很多情况下是不能用的