<分区>
根据我的研究,这似乎是一个绝对经典的 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
}
我想使用纯 CSS,并且答案是跨浏览器的。