【问题标题】:Sticky Footer and Content粘性页脚和内容
【发布时间】:2012-06-02 01:31:30
【问题描述】:

我正在使用此处的粘性页脚:http://ryanfait.com/sticky-footer/

CSS 如下所示:

* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
.footer, .push {
height: 4em;
}

HTML 是这样的:

<html>
    <head>
        <link rel="stylesheet" href="layout.css" ... />
    </head>
    <body>
        <div class="wrapper">
            <p>Your website content here.</p>
            <div class="push"></div>
        </div>
        <div class="footer">
            <p>Copyright (c) 2008</p>
        </div>
    </body>
</html>

如果我在包装器中添加另一个 div,是否可以通过某种方式设置其高度以填充包装器?谢谢!

【问题讨论】:

  • 不是您问题的答案,但您应该查看这个粘性页脚解决方案:cssstickyfooter.com。它不使用 push div。

标签: css sticky-footer


【解决方案1】:

只需将 height: 100%; 添加到要添加到包装器的 div 中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    • 2013-02-23
    • 2015-05-12
    • 1970-01-01
    • 1970-01-01
    • 2012-04-04
    相关资源
    最近更新 更多