方法一:推荐
设置父div的overflow:hidden;
方法二:
父div结束前增加一个空div style=”clear:both;”
.clear {
clear:both;
} <div>
<div style=”float:left;”>
<div class=” clear” />
</div>
方法三:由方法二变换:
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
方法四:设定高度