【发布时间】:2014-04-15 03:38:08
【问题描述】:
HTML
<div id="header">header</div>
<div id="body"><div id="content">content</div></div>
<div id="footer">footer</div>
CSS
#header {
background-color: red;
}
#body {
background-color: orange;
}
#content {
width: 500px;
margin: 0 auto;
background-color: yellow;
}
#footer {
background-color: blue;
}
body {
display: table;
height: 100%;
width: 100%;
}
#header,#footer,#body {
display: table-row;
height: 1px;
}
#body {
height: auto;
}
#content {
/* ??? */
}
html,body {
margin: 0;
padding: 0;
height: 100%;
}
This answer 在只需要拉伸顶级 div 时提供了一些很好的解决方案,但在我的场景中,我可以让 #body(橙色 bg)拉伸但我需要 #content(黄色)拉伸一路向下。
我该怎么做?
【问题讨论】:
标签: css sticky-footer