![](https://i-blog.csdnimg.cn/blog_migrate/0ade8e1fd1f393fe8cbdd7c6db1594c1.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>html5+css3发光渐变动画按钮</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
background-color: #000;
}
a {
position: relative;
text-decoration: none;
display: block;
width: 400px;
height: 200px;
text-align: center;
line-height: 200px;
color: aliceblue;
text-shadow: 10px 10px 20px black;
border-radius: 50px;
font-weight: 600;
font-size: 50px;
background: linear-gradient(to right,skyblue,pink,purple,yellow,coral,#ff3040);
background-size: 500%;
z-index: 9999;
}
a::before {
content: "";
position: absolute;
top: -5px;
right: -5px;
bottom: -5px;
left: -5px;
background: linear-gradient(to right,skyblue,pink,purple,yellow,coral,#ff3040);
background-size: 500%;
z-index: -10;
filter: blur(30px);
}
@keyframes example {
100% {
background-position: -500% 0;
}
}
a:link,
a:link::before {
animation: example 15s infinite;
}
</style>
</head>
<body>
<a href="#">绝美渐变</a>
</body>
</html>
本实例主要是对背景大小的缩放设置动画