after伪元素清除浮动
<style>
.clearfix:after {
content: ".";
display: block;
height: 0;
visibility: hidden;
clear: both;
}
.clearfix {
/* IE6、7清除浮动的操作 */
*zoom: 1;
}
</style>
双伪元素清除浮动
<style>
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
/* ie 6、7清除浮动的操作 */
*zoom: 1;
}
</style>