关于position:fixed;的兼容性问题

一般来讲,为兼容ie6与ie7会用到css hack

IE6中加入下滑线,eg:div{ _color: red }
IE7中加入*,eg:div{ * color: red }
其他浏览器不支持,只在IE6与IE7中起作用。

另一种写法:

IE6中: * html div{}
如,IE6不支持 position: fixed;,解决方法:

* html #menu{
  /*position: fixed;*/ 
  position: absolute;
  top: expression((e=document.documentElement.scrollTop)?e:document.body.scrollTop); 
}

/*or*/
* html, * html body{
  background-image: url(about: blank);
  background-attachment: fixed;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容