效果图:
具体实现代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>渐变背景动画</title>
<style>
body{
height: 100vh;
width: 100vw;
margin: 0;
padding: 0;
font-family: "montserrat";
background-image: linear-gradient(45deg,#2c3e50,#27ae60,#2980b9,#e74c3c,#8e44ad);
background-size: 400%;
animation: bganimation 15s infinite;
}
.text{
color: white;
text-align: center;
text-transform: uppercase;
padding: 30vh;
font-size: 22px;
}
@keyframes bganimation {
0%{
background-position: 0% 50%;
}
50%{
background-position: 100% 50%;
}
100%{
background-position: 0% 50%;
}
}
</style>
</head>
<body>
<div class="text">
实现渐变背景动画
<br />
山月剧
</div>
</body>
</html>