Bri*_*ham 5 html css height sticky-footer css-tables
#wrapper {
display: table;
min-height: 100%;
height: 100%;
margin: 0px auto;
}
#header-wrap,
#content-wrap,
#footer-wrap {
display: table-row;
height: 1px;
}
#content-wrap {
height: auto;
}
<div id="wrapper">
<div id="header-wrap"></div>
<div id="content-wrap">
<section id="content"></section>
</div>
<div id="header-wrap"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
#wrapper
充当表格#header-wrap
,其中 、#content-wrap
和#footer-wrap
是帮助将页脚推到页面底部的表格单元格。
如何让部分 #content
填充 #content-wrap
高度?
我不会使用绝对定位。
由于#content-wrap
浏览器确定了高度,因此您所要做的就是设置#content
为父元素高度的 100%。
#content{
height:100%;
}
Run Code Online (Sandbox Code Playgroud)
如果它没有设置为那个高度,我猜想可能稍后设置了一些 css 属性来覆盖这个高度。