<分区>
<分区>
这个链接显然是解决粘性页脚的“最佳”解决方案(只有当页面上的内容很少时才会停靠)。
http://ryanfait.com/sticky-footer/
当您在任何其他浏览器(我测试过的 Firefox、chrome)中调整窗口大小时,页脚会随窗口移动。在 IE7 中它不会移动,您需要刷新页面才能使其正确定位。
Google 似乎能够做到这一点,所以我想知道,他们是如何设法做到这一点而我做不到的?他们使用的是 JavaScript,还是我缺少优雅的 CSS 解决方案?
最佳答案
我以前使用过 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 */
HTML
<div id="wrap">
<div id="main" class="clearfix">
</div>
</div>
<div id="footer">
</div>
关于html - 粘性页脚未在 IE7 中更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12828319/