clear:both

<div style="clear:both"></div>

这段代码的做用是:清除同行元素,不允许其它元素与之在一行内。

<style>
.clear10{clear: both; height:10px; overflow:hidden;}
.yao{float:left;100px;}
</style>
<div class="yao">原来是这样</div>
<div class="yao">一直不知道这个东西</div>
<div class="clear10">哎呀</div>
<div class="yao">原来是这样</div>

那么.clear10起到的作用就是在清除前两行浮动的影响并且间隔10px的高度。

原文地址:https://www.cnblogs.com/wqing/p/3449310.html