ie6 fixed不兼容

让IE6支持fixed的处理方式

IE6代码

<!--[if IE 6]>

<style type="text/css">

html{overflow:hidden}

body{height:100%; overflow:auto;}

</style>

<![endif]-->

这个方法可以使ie6支持fixed,但有个缺陷,会使页面上原有的relative 和 position 定位都变成 fixed的效果。

解决方式:

用expression 可以让IE实现页面固定,

但是会出现抖动,通过设置 background-image 解决抖动,无需一张真实的图片。

* html , * html body{

background-image:url(about:blank);

background-attachment:fixed;

}

* html .box{   /* Top Left */

position:absolute;

left:expression(eval(document.documentElement.scrollLeft+100));

top:expression(eval(document.documentElement.scrollTop+100));

* html .box2{   /* Right Bottom  */

position:absolute;

left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));

top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))

}

原文地址:https://www.cnblogs.com/bigdesign/p/4037226.html