流光按钮
lix_uan 117 2

效果图

2

HTML

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>按钮</title>
        <link rel="stylesheet" href="index.css">
    </head>
    <body>
        <a href="">sunbutton</a>
    </body>
</html>

CSS

*{
    margin: 0;
    padding: 0;
}

body{
    background: #000;
}

a{
    text-decoration: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    background-size: 400%;
    width: 400px;
    height: 100px;
    color: #fff;
    line-height: 100px;
    text-align: center;
    text-transform: uppercase;
    border-radius: 50px;
    z-index: 1;
}

a::before{
    content: "";
    position: absolute;
    left: -5px;
    right: -5px;
    top: -5px;
    bottom: -5px;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    background-size: 400%;
    border-radius: 50px;
    filter: blur(20px);
    z-index: -1;
}

a:hover::before{
    animation: sun 8s infinite;
}

a:hover{
    animation: sun 8s infinite;
}

@keyframes sun{
    100%{
        background-position: -400% 0;
    }
}
预览图
评论区

索引目录