div层定位

来源:百度知道 编辑:UC知道 时间:2024/06/21 21:45:33
我想用层做一个左右侧的广告条,我想要拖动网页滚动条的时候,层不随着拖动而改变位置,想用CSS来做,请问要怎么设置?

单单position fixed不够,因为IE6不支持

css内容:

.r1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);right:20px;}
.r2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);right:20px;}
.l1{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:200px;
position:absolute; z-index:300; top:expression(offsetParent.scrollTop+200);left:20px;}
.l2{width:80px;height:80px;background:red;float:right;
position:fixed !important; top/**/:300px;
position:absolute; z-index:400; top:expression(offsetParent.scrollTop+300);left:20px;}

页面代码为:

<div class="r1"><a href="