您的位置首页百科问答

IE6不兼容position:fixed的完美解决方案

IE6不兼容position:fixed的完美解决方案

的有关信息介绍如下:

IE6不兼容position:fixed的完美解决方案

虽然XP系统至今(20150119)已经淘汰很久的时间了,但是难免有部分用户没更换系统,或者升级浏览器。所以对于前端工程师来说,解决IE6兼容position:fixed的问题显得很重要。特别是你需要用到头尾悬停调用的时候。

打开CSS文件,找到你需要调用的DIV文件位置。

.DIV名称{

height: 92px;

width: 100%;

position: fixed;

top: 0;

_position: absolute;

_bottom: auto;

_top:expression(eval(document.documentElement.scrollTop));

}

这个是头部悬停的CSS样式。极其简单的纯CSS样式就可以做到的效果,无须用JS、JQ等。之前自己没找到方法的时候也是极其苦恼(因为我也是在网上搜索自己想要的答案,没有具体的步奏、或者根本解决不了)

如果想要是底部悬停,则更换一段代码即可。

.DIV名称{

height: 92px;

width: 100%;

position: fixed;

top: 0;

_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)));

}