<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style type="text/css">
body{height: 2000px;}
.box1{width: 300px;height: 100px;background: red;position: absolute;right: 0;bottom: 0;}
/*固定定位:以當前可視文檔爲基準→→跟隨滾動條移動,不以最近父級定位元素爲基準*/
.father{width: 400px;height: 400px;border: 2px solid black;position: relative;}
/*固定定位:以當前可視文檔爲基準→→跟隨滾動條移動*/
span{width: 100px;height: 300px;background: blue;position: fixed;right: 0;bottom: 0;}
/*for IE6:略過(JS處理)*/
</style>
</head>
<body>
<div class="box1">box1</div>
<div class="father">father
<span class="box2">span.box2</span>
</div>
</body>
</html>
1.拖動滾動條前:
2.拖動滾動條後: