我想让一个固定大小的 div 向右浮动,剩下的空间需要留下。我以流畅的方式做到了这一点:
HTML:
<div class="container">
<div id="rightCntr">
</div>
<div id="leftCntr">
</div>
</div>
CSS:
#leftCntr {
float: none; /* not needed, just for clarification */
background: #e8f6fe;
/* the next props are meant to keep this block independent from the other floated one */
width: auto;
overflow: hidden;
}
#rightCntr { float: right; width: 213px;}
这在 Firefox 和 Chrome 中效果很好,但在 IE8 中却完全出错了。例子