fixed(兼容ie6)

来源:互联网 发布:数控车床编程代码大全 编辑:程序博客网 时间:2024/05/17 01:14

返回顶部在容器的边上,


<!DOCTYPE HTML><html><head><meta charset="utf-8" /><title>  </title><meta name="generator" content="editplus" /><meta name="author" content="" /><meta name="keywords" content="" /><meta name="description" content="" /><style type="text/css">*{ margin:0; padding:0;}.body{ width:990px; height:1500px; margin:0 auto; background-color:#d1d1d1;}.goTop{ width:30px; height:50px; background-color:#f50; position:fixed; bottom:100px; left:50%; margin-left:495px;}/*此margin-left为宽容器的一半*/.goTop{  _position:absolute;  _bottom:auto;  _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||100)));  }  </style></head><body><div class="body"></div><div class="goTop"></div></body></html>

参考新浪微博,方便自己以后使用