clearfix清除浮动
1.
.clear{clear:both;line-height:0;}
缺点:页面复杂的布局的话会产生很多空标签
2.
.clearfix:after{
visibility:hidden;
display:block;
font-size:0;
content:"";
clear:both;
height:0;
}
.clearfix{
*zoom:1;
}
3.
.clearfix:after{
content:"\200B";
display:block;
height:0;
clear:both;
}
.clearfix{
*zoom:1;
}
4.
.clearfix:before,.clearfix:after{
content:"";
display:table;
}
.clearfix:after{
clear:both;
}
.clearfix{
*zoom:1;
}
1.
.clear{clear:both;line-height:0;}
缺点:页面复杂的布局的话会产生很多空标签
2.
.clearfix:after{
visibility:hidden;
display:block;
font-size:0;
content:"";
clear:both;
height:0;
}
.clearfix{
*zoom:1;
}
3.
.clearfix:after{
content:"\200B";
display:block;
height:0;
clear:both;
}
.clearfix{
*zoom:1;
}
4.
.clearfix:before,.clearfix:after{
content:"";
display:table;
}
.clearfix:after{
clear:both;
}
.clearfix{
*zoom:1;
}