一,添加子元素法
1,添加子空元素
<style>
.clear{
clear:both;
}
</style>
<div class="clear"></div>
2,添加子空伪元素
<style>
div:after{
content:"";
display:block;
clear:both;
visibility:hidden;
}
</style>
<div>
some tags...
</div>
二,添加属性法
1,添加overflow属性
<style>
div{
overflow:hidden;
}
</style>
<div>
some tags...
</div>
2,添加float/position属性
<style>
div{
float:left;
}
</style>
<div>
some tags...
</div>
<style>
div{
position:absolute;
}
</style>
<div>
some tags...
</div>