兼容IE6的页面底部固定层CSS代码

有时候当我们需要把一个元素固定在页面的某个部位,一般都是用css中的“position:fixed;”方法来解决,但是IE6不支持fixed,所以今天分享一个兼容IE6的页面底部固定层CSS代码。如下:

.bottom {
    background:#000;
    color:#fff;
    bottom:0;
    margin:0 auto;
    position:fixed;
    height:23px;
    opacity:.60;
    filter:alpha(opacity=60);
    line-height:23px;
    width:100%;
    z-index:999;
    _bottom:auto;
    _width:100%;
    _position:absolute;
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)||0)-(parseInt(this.currentStyle.marginBottom, 10)||0)));
}

需要注意的是:使用以上代码后在ie中你会发现被固定定位的元素在滚动滚动条的时候会闪动,下面给出解决方法:

body{background:url(notfound)fixed;}

这样ie6中不支持fixed问题算是解决了。

posted @ 2013-12-14 12:31  rightzhao  阅读(177)  评论(0编辑  收藏  举报