一聚教程网:一个值得你收藏的教程网站

热门教程

IE6下CSS position:fixed 的修正解法

时间:2022-06-25 09:38:15 编辑:袖梨 来源:一聚教程网

IE6 不支援 CSS position:fixed 的 写法, 所以需要用其他写法达成.

网路上可以找到的解法非常多, 都列在下面的相关网页当参考资料, 有兴趣的在自行研究萝~


IE6 对於 CSS position:fixed 的修正解法
在此直接写我的作法:

 代码如下 复制代码

#id_or_class_name {
    position:fixed!important;
    _position:absolute;
    bottom:0;
    /*_bottom:-20px;*/
    _z-index:10;
    right:0;
}

修改时, 一般?g览器修改 bottom, right, 针对 IE6 修改 _bottom, _right 等. (以上 right 重复可以共用, 就不写在上面. (若是要出现在其他区域, 自行修改成 top / left.. 等即可.)

?: _bottom, _z-index 都是给 IE6 看的.

IE6 对於 CSS position:fixed 的修正解法2
这篇的解法我没有测试, 但是看起来是类似的, 写法比较简短, 详见: IE6 的 position:fixed Hack, 下述摘录自此篇解法:

 代码如下 复制代码

html, body {height:100%; overflow: auto;}
div {position:absolute;}
body>div {position:fixed;}

?: 前两行是针对 IE6, 最后那一行就是给一般的?g览器.

热门栏目