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>
相关推荐
研☆香1 天前
html框架页面介绍及制作
前端·html
be or not to be1 天前
CSS 定位机制与图标字体
前端·css
web小白成长日记1 天前
前端三个月速成,是否靠谱?
前端·react.js·前端框架·html·reactjs·webkit·scss
霍格沃兹测试学院-小舟畅学1 天前
Playwright处理iframe和Shadow DOM的实战技巧
前端·javascript·html
❆VE❆1 天前
【:has()】 CSS关系性伪类介绍及实战
前端·javascript·css
松涛和鸣1 天前
46、线程邮箱系统(C语言+多线程通信)
linux·c语言·网络·网络协议·tcp/ip·html
kk哥88991 天前
如何使用 CSS 变量实现响应式设计?
前端·css
蓝胖子的多啦A梦1 天前
TailwindCSS:高效构建现代化UI
前端·css·使用教程·tailwind css
be or not to be1 天前
前端布局与常见技术总结
前端·css·笔记
Han.miracle1 天前
JavaScript WebAPI 核心操作指南
前端·javascript·html