符合标准的固定在网页中固定位置的广告,不随滚动条的滚动而滚动。
* {
margin:0px;
padding:0px;
}
#main{
width:650px;
}
#modalwin{
width:100%;
height:100%;
background-color:red;
position:fixed !important; top/**/:0px;
position:absolute; z-index:100;
top:expression(offsetParent.scrollTop);left:expression(offsetParent.scrollLeft);
height:expression(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight);
width:expression(document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth);
display:none;
}
另外,可以根据情况,加上background-attachment: fixed; background-image: url();这两句CSS。
===============
<style>
.aa{height:2000px;width:40px;background:#eee;}
.bb{width:50px;height:80px;background:red;float:right;
position:fixed !important; top/**/:0px;
position:absolute; z-index:100; top:expression(offsetParent.scrollTop+20);right:20px;
</style>
<div class="aa">
我是不动的。
<script>for(var i=0;i<99;i++){document.write(i+"<br>");}</script>
<div class="bb">move</div>
</div>