使用这个Fiddle,如何改变它,使红色边框增长到页脚的顶部。最终结果将是红色框占据页面的中间部分。
HTML
<div class="wrapper">
<div class="header">HEADER</div>
<div class="body">BODY</div>
<div class="push"></div>
</div>
<div class="footer">FOOTER</div>
CSS
.header { height: 60px; background-color: #999; }
.footer { height: 61px; background-color: #999; }
.body { border: 1px solid red; }
/* Sticky Footer by Ryan Fait (http://ryanfait.com/) */
* { margin: 0; }
html, body { height: 100%; }
.wrapper { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -60px auto; /* the bottom margin is the negative value of the footer's height */ }
.footer, .push { height: 60px; /* .push must be the same height as .footer */ clear: both; }
form { height: 100%; }
/* Sticky Footer by Ryan Fait (http://ryanfait.com/) */
答案更新 我在下面接受了@dfsq 的答案,并从中汲取灵感来创建最终解决方案http://jsfiddle.net/jeljeljel/A3vZV/6/