<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>纯css3制作渐变背景颜色切换代码演示</title>
<style>
body {
margin: 0;
width: 100%;
height: 100vh;
font-family: "Exo", sans-serif;
color: #fff;
background: linear-gradient(-45deg, #FF0000, #FFA500, #8DEEEE, #EE7AE9);
background-size: 400% 400%;
animation: gradientBG 10s ease infinite;
}
@keyframes gradientBG {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.container {
width: 100%;
position: absolute;
top: 35%;
text-align: center;
}
h1 {
font-weight: 300;
}
h3 {
color: #eee;
font-weight: 100;
}
h5 {
color:#eee;
font-weight:300;
}
a,
a:hover {
text-decoration: none;
color: #ddd;
}
</style>
</head>
<body>
<div class="container">
<h1>纯css3渐变背景颜色切换代码</h1>
</div>
</body>
</html>
动画效果,随便截图一张表示一下