html - 粘性页脚未在 IE7 中更新

标签 html css internet-explorer-7

<分区>

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

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/

上一篇:css - 我应该导入哪些 .less 文件以开始使用 Twitter Bootstrap?

下一篇:html - 单击 anchor 标记时更改选择选项

相关文章:

html - 如何使用 CSS 使这些元素正确排列?

javascript - IE7 图像在从服务器加载 YUI 时消失

html - css 网格没有响应

html - 如何让类(class)优先于 id?

html - 如何在父左右标签之间的中心设置文本

html - 灵活的布局。如何在没有 CSS 的情况下显示条件内容?

css - IE7/IE8 间距与位置 :absolute?

javascript - mootools fx.Accordian 内容由于某种原因未显示

html - 具有所有时间可见的水平子菜单的水平菜单 css

html - 重叠div时一个div不可见