我出于某种原因永远无法清除元素,只是为了让人困惑!我试试这个:
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /*IE6*/
*:first-child+html .clearfix { zoom: 1; } /*IE7 */
到父元素,没有任何作用!真的很混乱:/
答案 0 :(得分:1)
您应该将.clearfix
类应用于您的元素。我想你要清除#page-wrap
。要将.clearfix
类应用于该div,请写:<div id="post-wrap" class="clearfix">
答案 1 :(得分:1)
/* The Magnificent Clearfix:
Updated to prevent margin-collapsing on child elements.
j.mp/bestclearfix */
.clearfix:before, .clearfix:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
.clearfix:after {
clear: both;
}
/* Fix clearfix:
blueprintcss.lighthouseapp.com/projects/15318/tickets/5-extra-margin-padding-bottom-of-page */
.clearfix {
zoom: 1;
}