<divstyle="height:100%"><divstyle="height:100px;"></div><divstyle="background:#FF0000;height:100%"></div></div>下面div高度占满浏览器剩余空间,页面不能出现滚动条...
<div style="height:100%">
<div style="height:100px;"></div>
<div style="background:#FF0000; height:100%"></div>
</div>
下面div高度占满浏览器剩余空间,页面不能出现滚动条
只能用JS了 根据自己需求改吧
body{ margin:0px; height:0px; overflow:hidden;}
#main{width:960px;margin:0px auto;border:1px solid #F00; overflow:hidden;}
填充top以下的部分
function getWindowSize() {
var client = {
x:0,
y:0
};
if(typeof document.compatMode != 'undefined' && document.compatMode == 'CSS1Compat') {
client.x = document.documentElement.clientWidth;
client.y = document.documentElement.clientHeight;
} else if(typeof document.body != 'undefined' && (document.body.scrollLeft || document.body.scrollTop)) {
client.x = document.body.clientWidth;
client.y = document.body.clientHeight;
}
return client;
}
var size = getWindowSize();
document.getElementById("main").style.height = (size.y-2)+"px"
本回答被提问者采纳