<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 在这里用link标签引入中文渐变色 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chinese-gradient">
<style>
/* 清除默认样式 */
* { padding: 0; margin: 0; }
/* 令html和body全屏显示 */
html, body { height: 100% }
/* 上面的那栏 */
.top {
/* 设置为固定定位 */
position: fixed;
/* 距离上边左边为0 */
top: 0;
left: 0;
/* 宽度铺满屏幕 */
width: 100%;
/* 给个合适的高度 */
height: 80px;
/* 蓝色背景 */
background: var(--靛蓝);
}
.main {
/* 给个合适的上边距 */
margin-top: 90px;
/* 给个合适的高度 */
height: 1000px;
/* 渐变背景 */
background: var(--天蓝);
}
/* 让盒子里的文字变成白色 */
div { color: white }
</style>
</head>
<body>
<div class="top" style="font-size: 30px;">无论你怎么滑动屏幕,我都是固定不变的</div>
<div class="main" style="font-size: 30px;">
这里是主盒子
</div>
</body>
</html>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 在这里用link标签引入中文渐变色 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chinese-gradient">
<style>
/* 清除默认样式 */
* { padding: 0; margin: 0; }
/* 令html和body全屏显示 */
html, body { height: 100% }
/* 上面的那栏 */
.top {
/* 设置为固定定位 */
position: fixed;
/* 距离上边左边为0 */
top: 0;
left: 0;
/* 宽度铺满屏幕 */
width: 100%;
/* 给个合适的高度 */
height: 80px;
/* 蓝色背景 */
background: var(--靛蓝);
/* 运行动画 */
animation: hide 2s ease-in infinite alternate
}
.main {
/* 给个合适的上边距 */
margin-top: 90px;
/* 给个合适的高度 */
height: 100%;
/* 渐变背景 */
background: var(--天蓝);
/* 运行动画 */
animation: move 2s ease-in infinite alternate
}
/* 让盒子里的文字变成白色 */
div { color: white }
@keyframes move { to { margin-top: 0 } }
@keyframes hide {
from { opacity: .7 }
to { opacity: .5 }
}
</style>
</head>
<body>
<div class="top" style="font-size: 30px;">无论你怎么滑动屏幕,我都是固定不变的</div>
<div class="main" style="font-size: 30px;">
这里是主盒子
</div>
</body>
</html>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68