我可以帮助您翻译这段关于页面布局的内容,其中包括一个可以任意高度的“fixed”头部和底部固定在页面底部的页脚。我正在寻找一种CSS解决方案,使内容div填充剩余空间(垂直)。在下面的jsfiddle中,我尝试过了这个问题,但是正如您所看到的,内容被遮盖在页脚后面。
HTML:
CSS:
HTML:
<main>
<header>
<ol>
<li>bar</li>
<li>foo</li>
</ol>
</header>
<section>
<div class="content"><div>
</section>
<footer></footer>
</main>
CSS:
header {
background-color: #abc;
z-index: 1000;
position: fixed;
top: 0px;
right: 0px;
left: 0px;
}
html, body, main, section {
height: 100%;
display: block;
}
.content{
background-color: #000;
height: 100%;
}
footer {
background-color: #def;
bottom: 0;
display: block;
height: 54px;
position: absolute;
width: 100%;
}
这是否可以通过纯CSS(3)实现? jsfiddle