一、兼容性最好-的伪元素方法:after
给浮动的父盒子提供一个伪元素
.father:after {
content: " ";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
二、额外标签法
<div class="father">
<div class="sonbox1"></div>
<div class="sonbox2"></div>
<div style="clear: both;"></div>
</div>