我不知道为什么我不能在我的页面中使用清除浮动方法。如果我使用经典<div class="clearfix"></div>
没有任何问题,但尝试使用更具语义的解决方案似乎不起作用。这是我的代码:
.clear:before, .clear:after {
content: " ";
display: table;
}
.clear:after {
clear: both;
content: "";
display: table;
}
例如,在这个 URL 中,我不能让它在之后清除:http form.woocommerce-ordering
: //melopienso.com/testingtwo/shop/
两个浮动元素具有以下代码:
<p class="woocommerce-result-count">
Showing all 5 results</p>
<form class="woocommerce-ordering" method="get">
<select name="orderby" class="orderby" data-cip-id="cIPJQ342845639">
<option value="menu_order" selected="selected">Default sorting</option><option value="popularity">Sort by popularity</option><option value="rating">Sort by average rating</option><option value="date">Sort by newness</option><option value="price">Sort by price: low to high</option><option value="price-desc">Sort by price: high to low</option> </select>
</form>
还有他们的 SCSS:
p.woocommerce-result-count { float: left !important; margin: 0 !important; }
form.woocommerce-ordering {
float: right !important;
&:before {
content: " ";
display: table;
}
&:after {
content: " ";
display: table;
clear: both;
}
}
所以 margin-top ofdiv.yit-wcan-container
没有生效。有任何想法吗?
非常感谢!