IE6兼容是前端设计人员最头疼的问题,有太多的bug了。position:fixed就是其中的一个,IE6下不支持fixed属性,今天把4个方位固定位置的样式代码整理出来,希望可以帮到大家。
1、左上角定位
#lt {
width:32px;
height:32px;
left:20px;
top:20px;
position:fixed;
_position:absolute;
background:#CCC;
_bottom:auto;
_top:expression(eval(document.documentElement.scrollTop + 20));
font-size:12px;
border:solid 1px #999;
line-height:32px;
text-align:center;
color:#FFF;
border-radius:3px;
}
2、右上角定位
#rt {
width:32px;
height:32px;
right:20px;
top:20px;
position:fixed;
_position:absolute;
background:#CCC;
_bottom:auto;
_top:expression(eval(document.documentElement.scrollTop + 20));
font-size:12px;
border:solid 1px #999;
line-height:32px;
text-align:center;
color:#FFF;
border-radius:3px;
}
3、左下角定位
#lb {
width:32px;
height:32px;
left:20px;
bottom:20px;
position:fixed;
_position:absolute;
background:#CCC;
_bottom:auto;
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginRight,20)||0)-(parseInt(this.currentStyle.marginTop,20)||0)));
font-size:12px;
border:solid 1px #999;
line-height:32px;
text-align:center;
color:#FFF;
border-radius:3px;
}
4、右下角定位
#rb {
width:32px;
height:32px;
background:#CCC;
position:fixed;
_position:absolute;
bottom:20px;
right:20px;
_bottom:auto;
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginRight,20)||0)-(parseInt(this.currentStyle.marginBottom,20)||0)));
font-size:12px;
border:solid 1px #999;
line-height:32px;
text-align:center;
color:#FFF;
border-radius:3px;
}
如果您觉得本文的内容对您的学习有所帮助:
关键字:
IE6定位 fixed