【问题标题】:How do I create a footer that will stick to the bottom of the screen regardless of the container height?无论容器高度如何,如何创建一个将粘在屏幕底部的页脚?
【发布时间】:2013-04-21 04:55:44
【问题描述】:

我似乎无法弄清楚这一点。我有一个页脚,无论容器的高度和屏幕大小如何,我都想在页面底部显示该页脚。似乎在一些较大的屏幕上,背景一直滚动到页面底部,页脚在中间,在普通的 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;
}

【问题讨论】:

标签: html css containers footer


【解决方案1】:

这应该让你开始:

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

看起来他们正在设置

min-height: 100%
height: auto !important

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

【讨论】:

  • 请务必同时设置html, body { min-height: 100%; }。
猜你喜欢
  • 2022-11-29
  • 1970-01-01
  • 2021-01-08
  • 1970-01-01
  • 2013-02-10
  • 2016-03-20
  • 2015-03-05
  • 2017-06-10
  • 2021-11-30
相关资源
最近更新 更多