我需要有wrapper
div元素爲全高,因此根據頁面的整個高度調整其高度,以便不顯示滾動條。讓我的包裝div元素全高
我的HTML:
<header>
I am the header and my height is fixed to 40px.
</header>
<div id="wrapper">
I am the wrapper
</div>
我的CSS:
html,body {
height: 100%;
background: blue;
margin: 0;
padding: 0;
}
header {
height: 40px; <-------- this value is fixed
background-color: green;
}
#wrapper {
height: 90%;
background-color: red;
}
我知道在wrapper
的height: 90%
是錯誤的,但我不知道該怎麼辦。
這裏是的jsfiddle:https://jsfiddle.net/3putthcv/1/
並且你不想使用任何javascript來計算窗口高度,然後將包裝高度設置爲'windowHeight - 40'? –