从我的研究来看,这似乎是一个绝对经典的CSS问题,但我无法找到明确的答案 - 所以StackOverflow就是这样.
如何设置内容div占据身高的100%,减去固定高度页眉和页脚占用的高度?
<body>
<header>title etc</header>
<div id="content">body content</div>
<footer>copyright etc</footer>
</body>
//CSS
html, body {
height: 100%;
}
header {
height: 50px;
}
footer {
height: 50px;
}
#content {
height: 100% of the body height, minus header & footer
}
Run Code Online (Sandbox Code Playgroud)
我想使用纯CSS,并且答案是跨浏览器的防弹.
css ×1