流光按钮
一、html
<a href="#">BUTTON</a>
二、css
*{
margin: 0;
padding: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #000000;
}
a{
position: relative;
width: 400px;
height: 100px;
line-height: 100px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
font-size: 24px;
color: #ffffff;
background: linear-gradient(to right, #03a9f4,#f441a5,#ffeb3b,#09a8f4);
background-size: 400%;
border-radius: 50px;
z-index: 1;
}
a::before{
content: "";
position: absolute;
top: -5px;
left: -5px;
bottom: -5px;
right: -5px;
background: linear-gradient(to right, #03a9f4,#f441a5,#ffeb3b,#09a8f4);
background-size: 400%;
border-radius: 50px;
z-index: -1;
filter: blur(20px);
}
a:hover{
animation: streamer 8s infinite;
}
a:hover::before{
animation: streamer 8s infinite;
}
@keyframes streamer {
100%{
background-position: -400%, 0;
}
}
效果图(记录,分享)
