私はこの同じ問題に何度も遭遇し続けています.float要素を含む流動的なdivには背景がありません(「高さがない」ため)。私は :after セレクター、 、さらには偽の高さを作ってみました。しかし、これらのソリューションはいずれも洗練されていたり一貫したものではありません。これに対処するための、最も適応性が高く、最も柔軟な方法を知りたいです。何度も再利用でき、二度と心配する必要がない「これがプロのやり方」の解決策を探しています。
これは、非常に単純な jsFiddle です。リストの背景はオレンジ色にする必要があります。 http://jsfiddle.net/y4Va3/
jsFiddle からのコード:
.wrapper {background-color: blue; width: 100%;}
.content {background-color: orange; width: 50%; margin: 0 auto;}
.bottom {background-color: green; width: 100%; clear: both;}
ul {margin: 0px 10px; padding: 0; float: left;}
li {list-style-type: none;}
<div class="wrapper">
<div class="content">
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
</div>
<div class="bottom">
Not much here
</div>
</div>
御時間ありがとうございます。