Html 页脚位置问题-CSS

Html 页脚位置问题-CSS,html,css,Html,Css,有人能帮我解释一下为什么页脚不在页面底部吗 您可以看到黑色页脚后面的空格。我不需要那个,我希望页脚准确地定位在页面底部 试试这个 .footer-container { bottom: 0; margin: 0 auto; position: absolute; width: 100%; } 您应该将.footer容器指定给底部:0;和位置:绝对,将页脚固定在底部 .footer-container { bottom: 0; position:

有人能帮我解释一下为什么页脚不在页面底部吗

您可以看到黑色页脚后面的空格。我不需要那个,我希望页脚准确地定位在页面底部

试试这个

.footer-container {
    bottom: 0;
    margin: 0 auto;
    position: absolute;
    width: 100%;
}

您应该将.footer容器指定给底部:0;和位置:绝对,将页脚固定在底部

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

你有很多选择来处理这个问题

选择1

.footer-container{
    position:absolute;
    bottom:0;
}
选择2

使用粘性页脚

选择3

html, body {
      padding: 0;
      margin: 0;
      height: 100%;
}

#wrapper {
      min-height: 100%;
      position:relative;
}

#content {
      padding-bottom: 75px;   /* This value is the height of your footer */
}

.footer-container {
      position: absolute;
      width: 100%;
      bottom: 0;
      height: 75px;  /* This value is the height of your footer */
}

您只需要在页脚之前添加一些内容(或者尝试上面列出的其他选项之一)

我这样做了,它修复了它:

  • 就在

  • 输入此html:
    test


  • 这使它正常工作。因此,这应该向您展示您的问题。要么给它一个最小高度,要么只是在那里添加你的内容(一些lorem ipsem等),或者找到另一种方法来修复它。

    Google sticky Footer确实,就像真棒一样,我使用了你的第三个选项,它对我有效!