无论容器高度如何,如何创建一个粘贴在屏幕底部的页脚?

时间:2013-04-21 04:55:44

标签: css html5 css3 containers footer

我似乎无法弄清楚这一点。我有一个页脚,我想在页面底部显示,无论容器的高度如何,无论屏幕大小如何。似乎在一些较大的屏幕上,背景一直滚动到页面的底部,页脚在中间,在普通的13英寸17英寸屏幕上,它没关系。

CSS:

#container {
background-color: #ffffff;
min-height: 320px;
margin: 100px auto;
width: 960px;
max-width: 100%;
}
#footer {
background-color: #FFFFFF;
width: 100%;
height: 50px;
position:absolute;
margin-top: 140px;
}

1 个答案:

答案 0 :(得分:1)

这应该让你开始:

http://twitter.github.io/bootstrap/examples/sticky-footer.html

看起来他们正在设置

min-height: 100%
height: auto !important

在主要内容部分,然后在其后添加页脚元素。