您的位置:首页 > 其它

两种清除浮动的方法

2009-12-30 21:10 162 查看
两种清除浮动的方法:
方法一:常用,在浮动元素的后面紧接着加一个<div style=”clear:both;”></div>
<div>
  <div style=”float:left;width:30%”></div>
  <div style=”float:right;width:68%;”></div>
  <div style=”clear:both;”></div>
</div>
方法二:浮动元素所在的父元素的样式里加一个"overflow:auto/hidden;"
<div style=”overflow:auto;”>
  <div style=”float:left;width:30%”></div>
  <div style=”float:right;width:68%;”></div>
  <div style=”clear:both;”></div>
</div>
嘿嘿嘿…
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: