解决IE6下Position:fixed问题(只用css)

在IE6.0及以下版本的浏览器里是不支持position:fixed。而在IE7,IE8,firefox,opera,chrome都可以完美的支持此特性的。解决此问题的要点主要有:

1).容器要有一个背景图片

2).设置它的滚动属性为fixed。

3).用IE特有的e­xpression方法计算出元素的top,left,right,bottom的量。

<style>
body {
_background-image: url(about:blank); /*用浏览器空白页面作为背景*/
_background-attachment: fixed; /* prevent screen flash in IE6 确保滚动条滚动时,元素不闪动*/
}
.erweima{position:fixed; top:300px;right:0;
_position: absolute;/*IE6 用absolute模拟fixed*/

margin-left: 25px;

_top: expression((document.body.scrollTop||documentElement.scrollTop)+ 300);/*IE6 动态设置top位置*/
}
</style>

原文地址:https://www.cnblogs.com/JerryWang24/p/3684899.html