粘滞页脚在IE7中没有更新

J.Z*_*Zil -1 html css internet-explorer-7

这是一个链接,显然是粘性页脚的"最佳"解决方案(只有当页面上的内容很少时才会停靠).

http://ryanfait.com/sticky-footer/

当您在任何其他浏览器(Firefox,我测试过的Chrome)中调整窗口大小时,页脚随窗口移动.在IE7中,它不会移动,您需要刷新页面以使其正确定位.

谷歌似乎能够做到这一点,所以我想知道,他们是如何设法做到这一点的,我不能?他们使用JavaScript,还是有一个优雅的CSS解决方案,我想念?

Flu*_*yte 5

我之前使用过Chris Coryier的解决方案,从来没有遇到任何IE问题:http://css-tricks.com/snippets/css/sticky-footer/

CSS

* { margin:0; padding:0; } 

html, body, #wrap { height: 100%; }

body > #wrap {height: auto; min-height: 100%;}

#main { padding-bottom: 150px; }  /* must be same height as the footer */

#footer { 
    position: relative;
    margin-top: -150px; /* negative value of footer height */
    height: 150px;
    clear:both;
} 

/* CLEAR FIX*/
.clearfix:after {content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix { height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
Run Code Online (Sandbox Code Playgroud)

HTML

<div id="wrap">

    <div id="main" class="clearfix">

    </div>

</div>

<div id="footer">

</div>
Run Code Online (Sandbox Code Playgroud)

  • 请将您的答案"自成一体",而不是简单地发布没有解释的链接.否则,当链接失效时,你的答案对任何人都没有帮助. (2认同)