1>清除子级元素的浮动时,使用clear:left、right、both
clear:both写成空盒子。放在css内末尾
2>清除父级元素的浮动时,使用overflow:hidden、auto、scroll(常用)
3>使用<br/>强制换行,消除浮动
4>伪元素清除浮动:
clear_fix::after,
clear_fix::before{
content: ' ';
display: block;
height: 0;
line-height: 0;
visibility: hidden;
clear: both;
}
clear_fix{
*zoom: 1;
}
5>双伪元素清除浮动:
clear_fix::after,
clear_fix::before{
content: ' ';
display: table;
clear: both;
}
clear_fix{
zoom: 1;
}