全民出游案例
【摘要】
全民出游
index.hyml代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta char...
全民出游
index.hyml代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./css/index.css">
<title>Document</title>
</head>
<body>
<div class="bg">
<!-- 云彩 -->
<div class="yuncai">
<img src="./images/yun1.png" alt="">
<img src="./images/yun2.png" alt="">
<img src="./images/yun3.png" alt="">
</div>
<!-- 气球 -->
<div class="qiqiu">
<img src="./images/san.png" alt="">
</div>
<div class="xiabiao">
<!-- 下标 -->
<img src="./images/1.png" alt="">
<img src="./images/2.png" alt="">
<img src="./images/3.png" alt="">
<img src="./images/4.png" alt="">
</div>
<!-- 周边游 -->
<div class="zhoubian">
<img src="./images/font1.png" alt="">
</div>
<!-- 小鹿 -->
<div class="xiaolu">
<img src="./images/lu.png" alt="">
</div>
</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
index.css代码
html {
height: 100%;
}
* {
margin: 0;
padding: 0;
}
body {
width: 100%;
height: 100%;
}
.bg {
width: 100%;
height: 100%;
background: url(../images/f1_1.jpg) no-repeat center 0;
background-size: cover;
}
/* 云彩 */
.yuncai {
position: relative;
}
.yuncai img {
position: absolute;
left: 50%;
}
.yuncai img:nth-child(1) {
margin-top: 20px;
margin-left: -300px;
animation: movey 1s infinite alternate linear;
}
.yuncai img:nth-child(2) {
margin-top: 100px;
margin-left: 450px;
animation: movey 1s infinite alternate linear 0.2s;
}
.yuncai img:nth-child(3) {
margin-top: 200px;
margin-left: -500px;
animation: movey 1s infinite alternate linear 0.4s;
}
/* 云彩动画 */
@keyframes movey {
to {
transform: translatex(20px);
}
}
/* 气球 */
.qiqiu {
position: relative;
}
.qiqiu img {
width: 110px;
position: absolute;
left: 50%;
margin-top: 100px;
margin-left: -320px;
animation: moveq 1s infinite alternate linear 0.4s;
}
/* 气球动画 */
@keyframes moveq {
to {
transform: translateY(-20px);
}
}
.xiabiao {
position: relative;
}
.xiabiao img {
position: absolute;
left: 50%;
top: 520px;
animation: moveq 1s infinite alternate linear ;
}
.xiabiao img:nth-child(1) {
margin-left: -430px;
animation: moveq 1s infinite alternate linear ;
}
.xiabiao img:nth-child(2) {
margin-left: -195px;
animation: moveq 1s infinite alternate linear 0.2s;
}
.xiabiao img:nth-child(3) {
margin-left: 45px;
animation: moveq 1s infinite alternate linear 0.4s;
}
.xiabiao img:nth-child(4) {
margin-left: 284px;
animation: moveq 1s infinite alternate linear 0.6s;
}
/* 周边 */
.zhoubian {
position: relative;
}
.zhoubian img {
width: 400px;
position: absolute;
left: 50%;
margin-left: -220px;
margin-top: 300px;
}
.xiaolu {
position: relative;
}
.xiaolu img {
position: absolute;
left: 50%;
margin-top: 100px;
margin-left: 100px;
}
- 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
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
这个案例就是使用一些动画效果,要注意的是那个背景图的全铺屏幕的时候,要首先设置html的高度为100%,之后进行书写就可以了,过程大概就是先写定位,确定好位置之后,写动画过程,就是@开头的代码(写在外面),最后写一个叫做ani开头的代码就可以了(写在里面)
文章来源: blog.csdn.net,作者:花花叔叔,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/qq_52077949/article/details/119917870
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)