问题:
I have the age-old problem of a div
wrapping a two-column layout. 我有一个古老的问题,即div
包装了两列布局。 My sidebar is floated, so my container div
fails to wrap the content and sidebar. 我的侧边栏处于浮动状态,因此我的容器div
无法包装内容和侧边栏。
<div id="container">
<div id="content"></div>
<div id="sidebar"></div>
</div>
There seem to be numerous methods of fixing the clear bug in Firefox: 似乎有许多方法可以解决Firefox中的明显错误:
-
<br clear="all"/>
-
overflow:auto
-
overflow:hidden
In my situation, the only one that seems to work correctly is the <br clear="all"/>
solution, which is a little bit scruffy. 在我的情况下,唯一似乎正确运行的方法是<br clear="all"/>
解决方案,该解决方案有些麻烦。 overflow:auto
gives me nasty scrollbars, and overflow:hidden
must surely have side effects. overflow:auto
给了我讨厌的滚动条,而overflow:hidden
必须肯定有副作用。 Also, IE7 apparently shouldn't suffer from this problem due to its incorrect behaviour, but in my situation it's suffering the same as Firefox. 另外,由于它的不正确行为,IE7显然不应该遭受此问题的困扰,但就我而言,它与Firefox一样遭受痛苦。
Which method currently available to us is the most robust? 我们目前可以使用的哪种方法最可靠?
解决方案:
参考一: https://stackoom.com/question/szP/我可以使用哪些-clearfix-方法参考二: https://oldbug.net/q/szP/What-methods-of-clearfix-can-I-use
来源:oschina
链接:https://my.oschina.net/stackoom/blog/3274976