CSS 常用定位
2.兼容法
?
#tbox{
width:47px; height:73px; float:right; position:fixed;
_position:absolute; ? ? //兼容IE6
_bottom:auto;?? ? //兼容IE6
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));?? ? //兼容IE6
_margin-bottom:45px;?//兼容IE6
}
#gotop{
width:47px; height:47px; background:url(../common/static/images/top.png) no-repeat; position:absolute; top:0px; display:none; cursor:pointer
}
??
?
?
<!-- 代码开始 -->
?
<div id="tbox">
?
<!-- <a id="gotop" href="javascript:void(0)"></a> -->
<a id="gotop" href="#"></a>
?
</div>
?
?
<!-- 代码结束 -->
?
?3.expression简短版
.returnTop{
position:fixed;
left:50%;
bottom:115px;
*bottom:116px;
cursor:pointer;
background-color:#fcfcfc;
border:1px solid #cfcfcf;
_position:absolute;
_bottom:110px;
_top:expression(documentElement.scrollTop+documentElement.clientHeight - this.clientHeight-118+'px');
margin-left:482px;
width:64px;
height:64px;
background-image:url(http://img5.cache.netease.com/tie/images/return-top.png);
background-position:12px 20px;
background-repeat:no-repeat;
}
.returnTop:hover,.returnTop:active{background-position:12px -40px}
.returnTop a{display:block;width:64px;height:64px;text-indent:-9999em;overflow:hidden}
?
<div id="returnTop" style="display: block; ">
<a href="javascript:;" statistics="action=click;value=returnTop;"><em></em>返回顶部</a>
</div>
?
效果在chrome如下: