<!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="12.index.css">
<title>全民出游</title>
</head>
<body>
<!-- 云 -->
<div class="cloud">
<img src="../图片/yun1.png" alt="">
<img src="../图片/yun2.png" alt="">
<img src="../图片/yun3.png" alt="">
</div>
<!-- 小标题 -->
<div class="pic">
<img src="../图片/1.png" alt="">
<img src="../图片/2.png" alt="">
<img src="../图片/3.png" alt="">
<img src="../图片/4.png" alt="">
</div>
<!-- 文字 -->
<div class="text">
<img src="../图片/font1.png" alt="">
</div>
</body>
</html>
*{
padding: 0;
margin: 0;
list-style: none;
}
/* 大背景 */
/* 默认状态下html和body的高度都是0,导致background-size: cover;缩放背景不成功 */
html{
height: 100%;
}
body{
height: 100%;
background: url(../图片/f1_1.jpg) no-repeat center 0 / cover;
/* background-size: cover; */
}
/* 云 */
.cloud img{
position: absolute;
left: 50%;
}
.cloud img:nth-child(1){
margin-left: -250px;
top: 20px;
animation: cloud 1s infinite alternate linear;
}
.cloud img:nth-child(2){
margin-left: 400px;
top: 100px;
animation: cloud 0.8s infinite alternate linear;
}
.cloud img:nth-child(3){
margin-left: -550px;
top: 200px;
animation: cloud 0.5s infinite alternate linear;
}
@keyframes cloud {
100%{
transform: translate(20px);
}
}
/* 文字 */
.text img{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
animation: move 2s;
}
/* 为了防止tranform属性被动画中的覆盖,最好重新将居中属性放在动画中 */
@keyframes move {
0%{
transform: translate(-50%,-50%) scale(1);
}
20%{
transform: translate(-50%,-50%) scale(0.1);
}
40%{
transform: translate(-50%,-50%) scale(1.4);
}
70%{
transform: translate(-50%,-50%) scale(0.8);
}
100%{
transform: translate(-50%,-50%) scale(1);
}
}
/* 小标题 */
.pic img{
position: absolute;
left: 50%;
}
.pic img:nth-child(1){
margin-left: -250px;
top: 700px;
animation: text 0.5s infinite alternate linear;
}
.pic img:nth-child(2){
margin-left: -100px;
top: 700px;
animation: text 0.8s infinite alternate linear;
}
.pic img:nth-child(3){
margin-left: 70px;
top: 700px;
animation: text 0.7s infinite alternate linear;
}
.pic img:nth-child(4){
margin-left: 220px;
top: 700px;
animation: text 0.4s infinite alternate linear;
}
@keyframes text {
100%{
transform: translateY(20px);
}
}
![image]()