<div id="top">
*height: auto;
min-height: 100%;*
<div id="content">
*min-height: 500px;*
</div>
<div id="middle">
*css ???*
</div>
</div>
<div id="footer">
</div>
当屏幕尺寸正常时,此代码效果不错。但在全屏模式下,页脚到达页面底部(想要的行为),但“中间”div必须增加其高度以获得页脚。我的意思是,这3个元素(内容,中间和页脚)必须是连续的。带DIV的连续版式
我应该使用哪个css规则来执行此行为?
在此先感谢!
UPDATE。我使用了几个CSS规则和工作,但不要在IE8(适用于IE9,Chrome,FF3和FF4)。有关CSS是:
Top{ height: auto; }
Content{ min-height: 100%; }
Middle{ overflow: auto; padding-bottom: 130px; }
Footer{ clear: both; height: 130px; margin-top: -130px; position: relative; }
您是否希望页脚始终保持在屏幕的底部,还是在内容压下时滚动? – 2011-04-27 14:33:28
@Thomas总是在底部,但不是固定的。 – CalypsOOO 2011-04-27 14:58:10
啊,好吧。查看我关于媒体查询的答案。您可以根据视口高度设置宽度和高度以及任何其他CSS属性。 – 2011-04-27 15:00:00