css定位

关于css定位fixed定位不兼容ie6,ie7的解决方案

/距离上边为0/

.sl-fixed-top{

bottom:auto;

top:0;

_bottom:auto;

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

}

/距离底部为0/

.sl-fixed-bottom{

bottom:0;

top:0;

_bottom:auto

_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-(parseInt(this.currentStyle.marginTop,10||0)-(parseInt(this.currentStyle.marginBottom,10||0))));

}

/距离左边为0;

.sl-fixed-left{

 left:0;

_position:absolute;

right:auto;

_left:expression(eval(document.documentElement.scrollLeft)) 

}

/对于右边为0/

.sl-fixed-right{

right:0;

left:auto;

_right:auto;

_left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10||0)-(parseInt(this.currentStyle.marginRight,10||0)i);

}

/Hack for ie6/

.sl-fixed-top,.sl-fixed-bottom,.sl-fixed-left,.sl-fixed-right{

_position:absolute;

}

你可能感兴趣的:(css定位)