首先,你看到红色了吗?。。。
http://jsfiddle.net/yaBqr/
HTML格式:
<div class="wrap">
<p class="left">To the left, two, three, four</p>
<p class="right">To the right, two, three, four</p>
</div>
CSS格式:
div.wrap { background: red; width: 300px; margin: 100px auto 0 auto; }
p.left { float: left; width: 100px; }
p.right { float: right; width: 100px; }
我知道你在想什么……”有什么问题吗?集装箱司清除段落有什么问题。在大多数情况下,是的,我通常会清除所有浮动的元素,但我尝试这样做:
http://jsfiddle.net/yaBqr/1/
我只想清除左div,这样背景只出现在左段落后面。IE7正在清除这两个浮动元素。即使没有更清晰的div!所以我甚至不能离开地面。
有什么想法吗?