<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body{
background-color: black;
}
div{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 400px;
height: 100px;
text-align: center;
font-size: 40px;
font-weight: 700;
line-height: 100px;
border-radius: 40px;
background-image: linear-gradient(to right,#03a9f4,#f441a5,#ffeb3b,#03a9f4);
background-size: 500%;
color: #fff;
z-index: 1;
}
div::before{
content: "";
position: absolute;
top: -5px;
left: -5px;
right: -5px;
bottom: -5px;
background-image: linear-gradient(to right,#03a9f4,#f441a5,#ffeb3b,#03a9f4);
background-size: 500%;
border-radius: 40px;
filter: blur(10px);
z-index: -1;
display: none;
}
div:hover::before{
animation: dh 6s infinite linear;
display: block;
}
div:hover{
animation: dh 6s infinite linear;
}
@keyframes dh {
100%{
background-position: -500%;
}
}
</style>
</head>
<body>
<div>
CONFIRM
</div>
</body>
</html>
CSS实现动态光效按钮
最新推荐文章于 2024-07-17 16:26:33 发布