底部的非固定页脚,在IE8中具有非固定标题的页面中

时间:2014-01-27 19:46:06

标签: html css internet-explorer-8 footer

我正在尝试将经典页脚放在页面底部。这个想法是页眉和页脚不固定,以最大化内容屏幕。它必须在IE8中工作,但以下代码不起作用。错误的部分是IE在<footer>以下留下了一个空格,尽管在Firefox中可以正常工作。

html, body
{
    height: 100%;
}

header
{
    height: 50px;
    margin-bottom: 22px;
}

#content
{
    box-sizing: border-box;
    min-height: 100%;
    height: auto;
    margin-top: -72px; /* To avoid white space below footer. Works in FF, but not in IE*/
    padding-top: 72px;
}

footer
{
    clear: both;
    height: 30px;
    background: #222;
    margin-top: -30px;
}

html代码很标准:

<body>
    <header>...</header>
    <div id="content">...</div>
    <footer>...</footer>
</body>

有没有办法在不修复IE8的情况下将页脚粘在底部?

P.S。我正在使用HTML5Shiv <header><footer>

1 个答案:

答案 0 :(得分:1)

我不能因为别人的工作而受到赞扬......但这对于实现这一目标非常有用:

http://www.cssstickyfooter.com

相关问题