我有3个带有ID的div header,content和footer.页眉和页脚具有固定的高度,它们的样式可以在顶部和底部浮动.我想content用jquery自动计算中间高度.我怎么能这样做?
#header {
height: 35px;
width: 100%;
position: absolute;
top: 0px;
z-index: 2;
}
#footer {
height: 35px;
width: 100%;
position: absolute;
bottom: 0px;
z-index: 2;
}
Run Code Online (Sandbox Code Playgroud)
提前致谢...:)
blasteralfred
我正在使用Boostrap示例使用CSS为网站创建粘性页脚,这一切都很好,页面调整大小后页脚底部保留在页面底部.在许多页面上,我有内容需要显示几乎整页,禁止页脚.因此,页面的内容部分需要设置为100%高度,因此其内容又可以调整为全高.
我们怎样才能让绿色容器达到全高,所以它触及顶部的页面顶部和底部的页脚顶部?
谢谢!
<div id="wrap">
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h1>Sticky footer</h1>
</div>
<p class="lead">This is the sticky footer template taken from the Bootstrap web site.</p>
<p class="lead">How can we make this green .container div the full height of its parent #wrap div?</p>
</div>
<div id="push"></div>
</div>
<div id="footer">
<div class="container"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
#wrap .container {
background-color: lightgreen;
}
/* Sticky footer styles */
html, body {
height: 100%;
/* The html and body elements cannot …Run Code Online (Sandbox Code Playgroud)