阮一峰的IT笔记:首页 -> 分类 -> css 查看所有文章:按分类 | 按月份

符合标准的固定在网页中固定位置的广告(转贴)

符合标准的固定在网页中固定位置的广告,不随滚动条的滚动而滚动。

* {
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>

« PHP: UTF-8兼容的substr()函数 | 首页 | Canon打印机“废弃墨水吸收器已满”的解决办法 »

About

This page contains a single entry from the blog posted on 2008年01月01日 14:47.

The previous post in this blog was PHP: UTF-8兼容的substr()函数.

The next post in this blog is Canon打印机“废弃墨水吸收器已满”的解决办法.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33

Post a comment