2010-11-26 110 views
0

如何在這種情況下設置div#包裹高度?如何在這種情況下設置div高度?

<body style="height:100%;width:100%;overflow:hidden;padding:0;margin:0;"> 
<div id="header" style="width:100%;height:50px;z-index:5;background:blue;padding:0;margin:0;">&nbsp;</div> 
<div id="wrap" style="width:100%;overflow:scroll;background:red;height:100%;padding:0;margin:0;"> 
<div id="content" style="width:100%;height:2000px;padding:0;margin:0;"> 
&nbsp; 
</div> 
</div> 
<div id="footer" style="width:100%;height:30px;z-index:5;background:green;padding:0;margin:0;">&nbsp;</div> 
</body> 
+0

我不明白你的意思 – 2010-11-26 20:41:52

回答

0

你不能真正建立一個div高度的高度:height:100%,你可能想嘗試min-height:400px!important; _height:400px;

1

這是你在找什麼?

http://jsfiddle.net/nkUwa/1/

嘗試在Firefox ...我不知道一種方法,使頁眉和頁腳固定高度,然後讓包裝和內容的「剩餘區域」像對於框架集使用...但是,您還可以將頁眉和頁腳的樣式設置爲position: absolute,並分別使用top: 0bottom: 0附加到視口的頂部和底部。