【问题标题】:Space between footer and bottom of the page页脚和页面底部之间的空间
【发布时间】:2016-01-19 22:29:53
【问题描述】:

我查看了该主题的其他问题,但答案对我没有帮助。 这有点难以解释,但我会尝试。所以我有一个页脚:

#fußzeile{
    width: 100%;
    background-color: #e9e8e5;
    padding-top: 14px;
    padding-bottom: 14px;
    bottom: 0;
    padding-left: 24px;
    height: 36px;
    text-align: center;
}

我试过overflow: hidden, height: 100% 等。 我使用 margin-top 将包装器向下推,然后它可以工作,但如果我最小化站点,差距又回来了。位置:绝对/相对也不起作用..

【问题讨论】:

  • 你需要把它放在一个小提琴中,你问的不是很清楚?
  • 一个简单的谷歌搜索'css sticky footer'会给你很多选择
  • 我使用了 body{padding: 0px;边距:0px} 已经.. 不起作用。我用谷歌搜索了它,但选项不是最好的,所以我决定在这里问。
  • 你能提供一个小提琴,以便我们可以可视化问题..

标签: html css


【解决方案1】:

尝试在您的 css 中使用以下内容:

#fußzeile{
    position: fixed;
    bottom: 0px;
}

【讨论】:

    【解决方案2】:

    试试这个:

    #fußzeile{
        display:block;
        position:absolute;
        left:0;
        right:0;
        bottom:0;
        background-color: #e9e8e5;
        padding-top: 14px;
        padding-bottom: 14px;
        padding-left: 24px;
        height: 36px;
        text-align: center;
    }
    

    Here 是一个工作演示。

    【讨论】:

      【解决方案3】:
      position: absolute;
      width: 100%;
      

      这通过添加 2 行代码为我纠正了它。

      【讨论】:

        【解决方案4】:

        当页脚上方没有内容时会发生这种情况。您可以尝试将页脚 div 移到任何容器外(如果它包含在容器中,请确保它是 html 的直接子级),然后将 POSITION 设为绝对;

        【讨论】: