【问题标题】:Footer not siting at bottom of page页脚不在页面底部
【发布时间】:2012-07-29 21:45:12
【问题描述】:

在我的网站上:http://www.thetechnodaily.com 主页上的页脚很好,因为内容很多。但是在内容较小的页面上,例如关于页面,它不在页面底部。页脚位于内容的末尾而不是页面底部。有什么办法可以让页脚始终停留在底部?

【问题讨论】:

    标签: html css wordpress footer


    【解决方案1】:

    是的,您可以使用粘性页脚

            <div id="footer"></div>
    
    #footer
            { 
            position: relative;
            margin-top: -50px; /* Give the height of footer as negative margin */
            height: 50px;
            clear:both;
            }
    

    此链接可能对您有所帮助

    http://www.cssstickyfooter.com/using-sticky-footer-code.html

    【讨论】:

    • 没有。我不是在谈论那个。看,Like Footer 在内容下方,所以它总是在底部。但是,当内容较少时,它仍然是内容的底部,而不是屏幕的底部。我希望它位于屏幕底部
    • 但是代码不起作用。你能检查一下 Firebug 中的代码并告诉我吗?
    【解决方案2】:

    如果您指的是始终显示在底部的固定页脚,您将需要使用固定位置bottom: 0px,这样即使内容没有填满屏幕,它也会一直停留在那里

     #footer_id {
          position:fixed;
          bottom:0px;
          height: "whatever";
        }
    

    【讨论】:

    • 我不认为 OP 指的是这个。与链接网页一样,页脚需要位于所有内容下方。
    猜你喜欢
    • 2012-10-19
    • 2015-05-09
    • 2020-04-04
    • 1970-01-01
    相关资源
    最近更新 更多