【问题标题】:Sticking my footer to the bottom of the page [duplicate]将我的页脚贴在页面底部[重复]
【发布时间】:2013-09-02 14:16:57
【问题描述】:

我的页脚不想粘在页面底部。我是 HTML 新手,我不能让它下去。

这是我的代码:

<div class="footer">
    Copyright &copy; 2013. All rights reserved
</div>

【问题讨论】:

标签: css sticky-footer


【解决方案1】:

简单的固定解决方案:

.footer {
   position: fixed; 
   bottom: 0;
}

简单的绝对解决方案:

.footer {
   position: absolute; 
   bottom: 0;
}

Fancier Sticky Footer:

html {
    position: relative;
    min-height: 100%;
}
body {
    margin: 0 0 100px; /* bottom = footer height */
}
.footer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100px;
    width: 100%;
    background: red;
}

【讨论】:

    【解决方案2】:

    StackOverflow 上有几个这样的问题,一个这样的问题是下面...

    How to align footer (div) to the bottom of the page?

    ...和I've given an answer to that question

    如果您不想找到答案,这里有两个快速链接:

    如果这不是您所要求的,或者您在实施方面需要帮助,请告诉我!我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2013-10-27
      • 2011-06-09
      • 1970-01-01
      • 2014-11-09
      • 2014-04-21
      • 2019-09-30
      • 2020-12-16
      • 2011-10-15
      相关资源
      最近更新 更多