您的位置:首页 > 其它

两种解决IE6不支持固定定位的方法

2014-08-05 11:56 281 查看
有两种让IE6支持position:fixed
1.用CSS执行表达式

*{margin:0;padding:0;}
* html,* html body{
background-image:url(about:blank);
background-attachment:fixed;
}
* html .fixed{
position:absolute;
bottom:auto;
top:expression(eval(document.documentElement.scrollTop+
document.documentElement.clientHeight-this.offsetHeight-
(parseInt(this.currentStyle.marginTop,10)||0)-
(parseInt(this.currentStyle.marginBottom,10)||0)));
}
.fixed{
position:fixed;
bottom:0px;
top:auto;
}


2.让body保持其原有高度,让html只有一个窗口那么高

*{margin:0;padding:0}
*html{overflow:hidden;}
*html body{height:100%;overflow:auto;}
.fixed{
position:fixed; _position:absolute;
left:0;
bottom:0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: