【发布时间】:2014-09-20 20:35:30
【问题描述】:
【问题讨论】:
标签: css height sticky-footer
【问题讨论】:
标签: css height sticky-footer
您必须简单地将height: 100; 设置为body、html 和content。
你正在用height: auto !important; 覆盖height: 100%;。
或者,如果您希望内容可增长,您可以创建两个层。一个带有内容,第二个带有背景。
【讨论】:
你可以这样做:
HTML:
* {
margin: 0;
}
html, body {
height: 100%;
}
.header {
background: red;
}
.wrapper {
height: 100%;
margin: 0 auto -40px;
background: gray;
}
.content {
width: 200px;
margin: 0 auto;
background: pink;
height: calc(100% - 18px); /*100% - the height of the header*/
}
.footer {
background:green;
}
.footer {
height: 40px;
}
【讨论】: