0

对于放置在窗口顶部或某处的分区,我们将为它提供一些相对余量。有没有办法将 div 设置在底部,比如在页脚上方?我将解释我的问题:我有一个页脚。
我有一个高度 = 200px 的 div
我有另一个高度 = 400px的 div
现在我想将它们放在窗口中,这样它们应该看起来像,它们被放置在页脚上。我怎样才能做到这一点?谢谢

4

1 回答 1

1

你的主要内容应该是这样的:

.wrapper {
   min-height: 100%;
   height: auto !important;
   height: 100%;
   margin: 0 auto -40em; /* The -40em should be adjusted to your page, just play around with it */
}

然后是你的 div heitgh200、div height400 和页脚。

这是一个完整的工作示例:

http://jsfiddle.net/bn72w/1/

这是一个关于粘性页脚的好教程:http ://ryanfait.com/resources/footer-stick-to-bottom-of-page/

于 2013-05-19T20:47:29.320 回答