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>
相关推荐
CappuccinoRose3 小时前
CSS 语法学习文档(十九)
前端·css·属性·flex·grid·学习资源·格式化上下文
前端 贾公子5 小时前
深入理解 Vue3 的 v-model 及自定义指令的实现原理(下)
前端·html
qq_24218863328 小时前
3389端口内网转发概述
前端·经验分享·html
Never_Satisfied9 小时前
在JavaScript / HTML中,数组查找第一个符合要求元素
开发语言·javascript·html
henry10101011 小时前
DeepSeek生成的网页小游戏 - 迷你高尔夫
前端·javascript·游戏·html
烤麻辣烫13 小时前
正则表达式快速掌握
前端·javascript·学习·正则表达式·html
长城202413 小时前
HTML5中可以省略属性值的11个属性总结
前端·html·html5·属性值·省略属性值
肖。354878709415 小时前
html中onclick误区,后续变量会更改怎么办?
android·java·javascript·css·html
用户57573033462415 小时前
🎨 CSS变量彻底指南:从入门到精通,99%的人不知道的动态样式魔法!
css
用户57573033462415 小时前
🎯 CSS 定位详解:从入门到面试通关
css