html流光按钮

出处bilibili猫咪爱狗

html 复制代码
<!DOCTYPE html>
<html>
    <head>
        <style>
            body {/*内容居中,背景色*/
                height: 100vh;
                display: flex;
                justify-content: center;           
                align-items: center;
                background-color: #000;
            }
            a { /*水平垂直居中*/
                position: relative;
                display: inline-block;
                width: 200px;
                height: 60px;
                background-color: skyblue;
                color: #fff;
                line-height: 60px;
                text-align: center;
                /*渐变背景*/
                text-decoration: none;
                background: linear-gradient(90deg,
                    #03a9f4,
                    #f441a5,
                    #ffeb3b,
                    #03a9f4
                );
                /*圆角*/
                background-size: 400%;
                border-radius: 10px;
            }
            /*渐变动画*/
            @keyframes animate {
                0% {
                    background-position: 0 0;
                }
                100% {
                    background-position: 400% 0;
                }
            }
            /*鼠标悬停展示*/
            a:hover {
                animation: animate 8s linear infinite;
            }
            a:hover:before {
                filter: blur(20px);
                opacity: 1;
            }
            /*光影盒子*/
            a:before {
                content: '';
                position: absolute;
                left: -5px;
                top: -5px;
                right: -5px;
                bottom: -5px;
                z-index: -1;
                background: linear-gradient(90deg,
                #03a9f4,
                #f441a5,
                #ffeb3b,
                #03a9f4);
                background-size: 400%;
                border-radius: 10px;
                opacity: 0;
                transition: all 1s;
            }
        </style>
    </head>
    <body>
        <a href="#">Button</a>
    </body>
</html>
相关推荐
酷炫码神2 小时前
Day 2|CSS 盒模型:把昨天的骨架,变成能看的页面
前端·css
keyipatience4 小时前
JS学习笔记(2)数组,函数,作用域,对象
前端·javascript·笔记·学习·html
oicola5 小时前
Ant Design v5 vs Tailwind CSS:组件库与样式框架的终极对决
前端·css
java1234_小锋7 小时前
【技术专题】HTML5 网页技术 - HTML5 列表标签
前端·html·html5
data analyse 45610 小时前
前端白屏问题按路由和资源加载顺序定位
大数据·前端·人工智能·数据分析·html
软件技术NINI19 小时前
美妆商城html+Css+js 4页
javascript·css·html
2603_965896621 天前
Grid 网格布局|CSS 二维页面排版体系
前端·css
多喝水身体棒1 天前
# CSS Grid布局入门,二维布局再也不用float了
css
hellojackjiang20111 天前
IM聊天不掉线?生产级WebSocket断线重连、心跳保活实战
websocket·网络协议·网络编程·html5·即时通讯·im
软件技术NINI1 天前
化妆品html+css+js 7页
javascript·css·html