1. clear:both
添加兄弟元素,具有属性clear:both。(闭合浮动)
2. overflow:hidden
在父元素添加属性overflow:hidden。(触发BFC)
3. E:after{content:“”}
为父元素添加after伪类:after{content:“”}。(行内元素)
IE6-7使用* zoom: 1。(触发hasLayout)
E:after{ content: "";}
E{ *zoom: 1;}
4. 双伪元素清除
父元素添加类clearfix中:
.clearfix:after,.clearfix:before{
content: "";
display: table;
}
.clearfix:after{
clear: both;
}
.clearfix{
*zoom: 1;
}