样式 style="clear:both"

<div style="clear:both"></div>
clear:both该属性的值指出了不允许有浮动对象的边。
通俗的讲:这段代码的做用是:清除同行元素,不允许其它元素与之在一行内。
我经常用的代码。 <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的高度。使用下面的<div class="yao">大家好</div>与前行不在同一行内。
原文地址:https://www.cnblogs.com/dearbear/p/3448497.html