美文网首页
关于position:fixed;的兼容性问题

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

作者: 会有猫惹 | 来源:发表于2017-03-04 17:19 被阅读0次

一般来讲,为兼容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;
}

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/pmdjgttx.html