如何让页脚停留在页面底部

时间:2013-07-09 02:22:45

标签: css position footer

我想知道如果没有足够的内容,我怎么能让页脚留在底部。

如果我将其用于css position:absolute; bottom:0;

问题是如果页脚浮动并覆盖内容的内容足够多。

http://niceguy.co/

感谢。

3 个答案:

答案 0 :(得分:1)

http://www.cssstickyfooter.com/应该是您正在寻找的。

答案 1 :(得分:0)

您需要定义position: fixed; bottom: 0; width: 100%;

答案 2 :(得分:0)

您的结构需要看起来像这样:

<body>
    <section id="wrap><!-- This has header, etc --></section>
    <footer></footer>
</body>

然后CSS(其中50px是页脚的高度,只需替换它):

html, body { height: 100%; }
#wrap {
     min-height: 100%;
     padding-bottom: 50px;
}
footer {
    height: 50px;
    margin-top: -50px;
}
相关问题