position:fixed; IE6下解决办法。。

 

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
* { margin:0; padding:0; }
html { background:url(123.txt) fixed; }
body { height:2000px; }
.box { width:100px; height:80px; background:#3cf; position:fixed; _position:absolute; _top:expression(offsetParent.scrollTop + 10); top:10px; right:20px; }
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>

 

一、html { background:url(123.txt) fixed; }  解决ie6下,下拉滚动条有抖动现象。
  123.txt 可以是任何并不存在的文件,如:url(about:black);
二、top:expression(offsetParent.scrollTop + 10)  如果是距离头部0px的话,那么应该top:expression(offsetParent.scrollTop)
top: expression(offsetParent.scrollTop + offsetParent.clientHeight-offsetHeight) 如果是想要层在网页底部的话用这个。 



posted @ 2012-02-11 16:19 o0三石0o 阅读(37) 评论(0) 编辑 收藏