【问题标题】:Footer does not extend to the bottom of the page on website [duplicate]页脚没有延伸到网站页面的底部[重复]
【发布时间】:2013-10-23 20:43:11
【问题描述】:

可能重复:
How to force a DIV block to extend to the bottom of a page, even if it has no content?

这几天我一直在阅读,但还没有解决方案。

我正在用普通的旧 html 编写一个网站,并且页脚似乎不想扩展到页面底部。我一直在测试,但仍然没有结果。

这里是代码sn-p。

<div id="footer">
        <div id="footer_content">
            <p> &copy; 2011 KRG Maintenance - All Rights Reserved - Contact Us</p>
        </div> <!--footer content ends-->
    </div> <!--footer ends-->
</body>
</html>

body{
    position:relative;
    background:#383d43 url(../images/body_bg.jpg) repeat-x;
    color:#000;
    font:62.5% Myriad Pro,Arial,sans-serif;
}
#footer{

    width: 100%;
    float: left;
    clear: both;
    height: 100%;
    background-color: #ffffff;
    background: #1e2329 url(../images/footer_bg.jpg) repeat-x;

}

#footer_content{

    margin: auto;
    width: 943px;
    padding: 17px 17px 0px 0px;
}

我是延伸到页面底部的页脚,但它只是挂在下面的空白处。 我在这里真的很困惑,似乎其他解决方案没有解决它。 任何帮助将不胜感激。

【问题讨论】:

  • 感谢罗伯特·哈维。我昨天试过了,没有成功。出于某种原因,它现在可以工作了:S
  • “我昨天试过了,但没有成功。由于某种原因它现在可以工作了”——哇,我们都知道那种感觉吗。

标签: html css footer


【解决方案1】:

Robert Harvey 的第一个链接看起来不错:确保主体本身足够大,以允许 &lt;div&gt; 执行您想要的操作。

所以,height: 100% 为您的body 应该可以帮助您。

【讨论】:

    【解决方案2】:
    #footer{
    display: block;
    width: 100%;
    float: left;
    clear: both;
    height: 100%;
    background-color: #ffffff;
    background: #1e2329 url(../images/footer_bg.jpg) repeat-x;
    }
    

    【讨论】:

      猜你喜欢
      • 2014-11-30
      • 1970-01-01
      • 2011-08-05
      • 2015-10-21
      • 2020-12-16
      • 2012-12-12
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      相关资源
      最近更新 更多