布局是左中右,宽度固定,左右随首中间的DIV的高度不同要有高度的变化,用表格或iframe实现很简单,但用div+css可有些麻烦,
试过用JS来初始化共左中右高度,但在中间DIV高度有变化时,左右的DIV高度并不随着变,终于到了一种“隐藏容器溢出”和“正内补丁”和“负外补丁”结合的方法,
主要解决的代码是在左右DIV中加入
padding-bottom:100000px;margin-bottom:-100000px;
样式
代码如下:
<style type="text/css">
<!--
#wrap{overflow:hidden;}
#sidebar_left,#sidebar_right{padding-bottom:100000px;margin-bottom:-100000px;}
-->
</style></head>
<body>
<div id="wrap" style="width:300px; background:#FFFF00;">
<div id="sidebar_left" style="float:left;width:100px; background:#FF0000;">Left</div>
<div id="sidebar_mid" style="float:left;width:100px; background:#666;">
Middle<br />
Middle<br />
Middle<br />
Middle<br />
Middle<br />
Middle<br />
Middle<br />
Middle<br />
Middle<br />
</div>
<div id="sidebar_right" style="float:right;width:100px; background:#0000FF;">Right</div>
</div>