【问题标题】:How to do you get a footer to stick to the bottom of the page? [duplicate]如何让页脚粘在页面底部? [复制]
【发布时间】:2015-05-06 07:12:40
【问题描述】:

我要求页脚固定在页面底部。当前,当视口已满且未扩展时,它会粘在底部。但是,当我使用较小的分辨率时,我会得到一个垂直滚动条,并且页脚保持在原来的视口位置,并且不会粘在页面底部。

链接:http://cazdesigns.net/caz/pictures.html

任何帮助将不胜感激。我尝试了多种技术,这些技术似乎只在视口中起作用,而在涉及垂直滚动时不起作用。

【问题讨论】:

  • 你尝试了哪些技术,我们只能看到第一个吗?

标签: html css footer


【解决方案1】:

您需要使用 position:fixed; 将以下内容添加到您的 CSS:

#footer{position:fixed;}

【讨论】:

    【解决方案2】:

    只需将此 css 代码与您的 css 合并:-

    html { min-height:100%; float:left;} 
    body { min-height:100%; float:left; position:relative;}
    #footer { position:absolute; bottom:0; left:0; width:100%; padding-top:25px;}
    

    并从#gallery div 中删除 Postion:relative...

    【讨论】:

      猜你喜欢
      • 2014-01-13
      • 2014-08-13
      • 1970-01-01
      • 2023-04-01
      • 2013-09-26
      • 1970-01-01
      • 2016-05-01
      • 2012-10-19
      相关资源
      最近更新 更多