什么是目前清除浮动的最佳解决方案,例如“< div style ='clear:both'>< / div>&quot ;? [英] What is the current best solution to clear floats, such as "<div style='clear: both'></div>"?

查看:187
本文介绍了什么是目前清除浮动的最佳解决方案,例如“< div style ='clear:both'>< / div>&quot ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用

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

清除浮动...并且看到的是

to clear the floats... and have seen cases where it is

<div style="clear: both; height: 1px; line-height: 1px"></div>

并且已经看到了clearfix,有些隐藏了并使其与背景颜色相同。现在Compass和Blueprint也有一个 + clearfix 。现在最好的清除浮动的方法是什么,现在可能我们不需要支持IE 6?

and have seen clearfix, and some with a hidden . and make it the same color as the background. Now Compass and Blueprint also have a +clearfix. What is the current best way to clear floats, now that probably we don't need to support IE 6?

推荐答案

了解到
content:;
display:table;
clear:both;
可在IE 8之后的所有浏览器中使用

I have learned that content: ""; display: table; clear: both; work with all browsers after IE 8+

这篇关于什么是目前清除浮动的最佳解决方案,例如“&lt; div style ='clear:both'&gt;&lt; / div&gt;&quot ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆