【发布时间】:2015-03-05 18:51:46
【问题描述】:
我正在使用 twitter 引导程序“粘性页脚”示例代码。
粘性页脚工作正常,但现在我想通过使主体(或 div)占据html 元素的高度来“填充”剩余空间,然后应用背景颜色。
HTML
<body>
<p>....</p>
<footer class="footer">
<div class="container">
<p>Place sticky footer content here.</p>
</div>
</footer>
</body>
CSS
html {
position: relative;
min-height: 100%;
background-color: green;
/* background-color: transparent; */
border: 3px solid blue;
}
body {
background-color: tomato;
padding-top: 20px;
border: 3px solid black;
min-height: 100%;
}
.footer {
position: absolute;
bottom: 0px;
width: 100%;
height: 60px;
background-color: #0bb;
}
这是一个有效的演示 - http://jsbin.com/xurulofame/1/edit?html,css,output
如何使 BODY 元素占据 HTML 元素的 100% 高度 - 从而用“番茄”颜色填充背景?
【问题讨论】:
标签: html css twitter-bootstrap