<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3白云飘动动画特效</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
background: linear-gradient(to bottom, #87CEEB 0%, #E0F7FA 100%);
}
.sky {
position: relative;
width: 100%;
height: 100%;
}
.cloud {
position: absolute;
background: white;
border-radius: 50%;
filter: blur(5px);
opacity: 0.8;
animation: float linear infinite;
}
.cloud:nth-child(1) {
width: 150px;
height: 60px;
top: 20%;
left: 10%;
animation-duration: 60s;
box-shadow:
20px 20px 0 0 white,
40px 10px 0 0 white,
60px 20px 0 0 white;
}
.cloud:nth-child(2) {
width: 200px;
height: 80px;
top: 30%;
left: 40%;
animation-duration: 80s;
animation-delay: 10s;
box-shadow:
30px 30px 0 0 white,
60px 20px 0 0 white,
90px 30px 0 0 white;
}
.cloud:nth-child(3) {
width: 180px;
height: 70px;
top: 50%;
left: 20%;
animation-duration: 70s;
animation-delay: 5s;
box-shadow:
25px 25px 0 0 white,
50px 15px 0 0 white,
75px 25px 0 0 white;
}
.cloud:nth-child(4) {
width: 120px;
height: 50px;
top: 60%;
left: 70%;
animation-duration: 50s;
animation-delay: 15s;
box-shadow:
15px 15px 0 0 white,
30px 10px 0 0 white,
45px 15px 0 0 white;
}
@keyframes float {
0% {
transform: translateX(0) translateY(0);
}
25% {
transform: translateX(50px) translateY(-10px);
}
50% {
transform: translateX(100px) translateY(0);
}
75% {
transform: translateX(50px) translateY(10px);
}
100% {
transform: translateX(0) translateY(0);
}
}
.footer {
position: absolute;
bottom: 10px;
width: 100%;
text-align: center;
font-family: Arial, sans-serif;
color: #333;
}
.footer a {
color: #0066cc;
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="sky">
<div class="cloud"></div>
<div class="cloud"></div>
<div class="cloud"></div>
<div class="cloud"></div>
</div>
<div class="footer">
</div>
</body>
</html>
CSS3白云飘动动画特效
于 2025-05-09 17:29:43 首次发布