您的位置:首页 > Web前端 > HTML

无抖动层回到顶部(兼容所有主流浏览器)

2011-11-16 16:38 316 查看
不用多说直接贴代码

<!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">

<head>

    <title></title>

    <style type="text/css">

        .go-top

        { position: fixed;cursor:default;right: 50px;bottom: 30px;width: auto; height: auto; padding: 4px; padding-top:8px; border: 1px solid gray; font-size: 12px;

  height: 20px;background-color: #DDDDDD;vertical-align:middle;_position: absolute; _top: expression((ff=document.documentElement.scrollTop    + document.documentElement.clientHeight - this.offsetHeight)+'px'); }

        *{ _text-overflow: ellipsis;}

    </style>

</head>

<body>

    <div style="background-color: red;">页眉</div>

    <div style="margin-top: 2000px; background-color: red;">页脚</div>

    <div class="go-top" onclick="location.href='#'">TOP</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐