背景层自适应高度

1
<div style=”overflow:hidden; _height:1%; border:1px#333 solid; width:600px; margin:auto;”>
<div style=”width:300px; float:left; height:100px; background:#f60;”></div>
<div style=”width:300px; float:left; height:300px; background:#ccc;”></div>
</div>

2
<div class=”m clear”>
<div>左</div>
<div>右</div>
</div>
.clear:after {
 content: “.”;
 display: block;
 height: 0;
 clear: both;
 visibility: hidden;
}

关于after可以参考:http://www.blueidea.com/tech/web/2005/3065.asp

Technorati 标记: css, 背景, 自适应, 高度