<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
#top{
text-align: center;
background-color: #01204f;
color: #fff;
padding: 10px 0;
position:fixed;
width: 100%;
height: 30px;
top: 0;
}
</style>
</head>
<body>
<div id="top">
web开放功能很强大啊!
</div>
<!-- 50 = top的高度 + padding 的偏移 -->
<div style="height: 2000px;margin-top: 50px;">
<p>222222</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
<p>12331</p>
</div>
</body>
</html>