【CSS】css实现流光效果-按钮流光显示效果-自发光

论坛 期权论坛 脚本     
匿名技术用户   2021-1-7 09:29   301   0

废话不多说,直接上代码

<body>
    <a href="">Streamer</a>
</body>
    * {
        padding: 0;
        margin: 0;
    }

    body {
        background-color: black;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
    }

    a {
        position: relative;
        width: 400px;
        height: 100px;
        line-height: 100px;
        font-size: 24px;
        text-transform: uppercase;
        text-decoration: none;
        text-align: center;
        color: #fff;
        border-radius: 50px;
        background-image: linear-gradient(to right, #03a9f4, #f441a5, #ffeb3d, #09a8f4);
        background-size: 400%;
        z-index: 1;
    }

    a::before {
        content: '';
        position: absolute;
        top: -5px;
        right: -5px;
        left: -5px;
        bottom: -5px;
        border-radius: 50px;
        background-image: linear-gradient(to right, #03a9f4, #f441a5, #ffeb3d, #09a8f4);
        background-size: 400%;
        z-index: -1;
        filter: blur(20px);
    }

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

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

    @keyframes sun {
        100% {
            background-position: -400% 0;
        }
    }

最终效果如下

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP