博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理

顶部不动HTML通知

Posted on 2011-10-20 12:54  PHP-张工  阅读(1206)  评论(0编辑  收藏  举报

HTML在页面滚动时顶部不动。

<!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">
body, html
{
width
:100%;
height
:100%;
}

*
{
margin
:0px; padding:0px;
}

body
{
font-size
:14px;
line-height
:1.5;
font-family
:Consolas Tahoma Verdana;
}
</style>
</head>
<body>
<div id="divTop" style="background-color:#eee; border-bottom:solid 1px gray; line-height:30px; position:fixed; top:0px; width:100%; z-index:1;">
顶部内容
</div>
<div style="height:2000px; position:relative; top:30px; _top:0px;">sssssssssss</div>
</body>
</html>

下载:https://files.cnblogs.com/zjfree/htmlTopMsg.rar