1、给父元素添加高度,后面的元素清除浮动
2、写一个空div专门用来清除浮动,只需要给这div添加属性clear:both;即可
3、给父元素添加属性overflow:hidden;
4、给父元素添加浮动
5、给当前元素添加伪类,如:
.box:after {
content: " . ";
display: block;
clear: both;
height: 0; visibility: hidden;/ footsize: 0;