代码之家  ›  专栏  ›  技术社区  ›  Razor

HTML页脚问题

  •  10
  • Razor  · 技术社区  · 16 年前

    是否可以创建一个位于站点底部的页脚DIV,而不管中间有多少信息?

    目前,我所拥有的分区的位置取决于我在正文中拥有多少内容。

    参见:

    How do you get the footer to stay at the bottom of a Web page?

    4 回复  |  直到 10 年前
        1
  •  11
  •   JasonS    16 年前

    我决不是CSS专家,但这在主要浏览器中都适用:

    .d_footer
    {
        position:fixed;
        bottom:0px;
        background-color: #336699;
        width:100%;
        text-align:center;
        padding-top:5px;
        padding-bottom:5px;
        color:#ffffff;
    }
    
        2
  •  2
  •   Jonathan Mueller    16 年前

    浮动内容DIV并使用页脚DIV clear: both .

        3
  •  1
  •   Razor    16 年前

    我知道我把这个标记为正在被回答,但结果我遇到了另一个问题。页脚很好地位于页面的底部,但是,如果内容超过了页脚,那么页脚只会浮在内容上。

    如果内容超过了底部,是否有办法保持页脚在页面底部而不重叠?

    我的直觉是使用iframe,但我不知道该怎么做。

        4
  •  0
  •   Meta    15 年前

    Jonathanmueller是对的,非常有效。

    我一直在浏览帖子,试图做到这一点。我能找到的只是固定在窗户的底部。 谢谢!