前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >非常好看的前端按钮带动画 (CSS)

非常好看的前端按钮带动画 (CSS)

作者头像
xlj
发布2021-07-14 11:52:49
1.5K0
发布2021-07-14 11:52:49
举报
文章被收录于专栏:XLJ的技术专栏

写了一个非常好看的CSS效果按钮,带动画

效果图

源代码

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>按钮美化</title>

    <!-- 初始化 -->
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        html,body {
            height: 100%;
        }

        body {
            font-size: 18px;
            padding: 1em;
        }

        span.ButtonStyleBlue {
            color: #000000;
            border: 2px solid #18dcff;
            display: inline-block;
            padding: 5px 10px;
            border-radius: 4px;
            box-shadow: 2px 2px 2px #16c8e7;
            margin: 4px 4px;
            cursor: pointer;
            user-select: none;
        }

        span.ButtonStyleBlue:hover {
            animation: 0.5s buttonStyleBlue;
            animation-fill-mode: forwards;
        }

        span.ButtonStyleRed {
            color: #000000;
            border: 2px solid #d30707;
            display: inline-block;
            padding: 5px 10px;
            border-radius: 4px;
            box-shadow: 2px 2px 2px #b40707;
            margin: 4px 4px;
            cursor: pointer;
            user-select: none;
        }

        span.ButtonStyleRed:hover {
            animation: 0.5s buttonStyleRed;
            animation-fill-mode: forwards;
        }

        span.ButtonStyleYellow {
            color: #000000;
            border: 2px solid #f0ec1a;
            display: inline-block;
            padding: 5px 10px;
            border-radius: 4px;
            box-shadow: 2px 2px 2px #d1ce18;
            margin: 4px 4px;
            cursor: pointer;
            user-select: none;
        }

        span.ButtonStyleYellow:hover {
            animation: 0.5s buttonStyleYellow;
            animation-fill-mode: forwards;
        }

        span.ButtonStyleGreen {
            color: #000000;
            border: 2px solid #75fc1b;
            display: inline-block;
            padding: 5px 10px;
            border-radius: 4px;
            box-shadow: 2px 2px 2px #67db19;
            margin: 4px 4px;
            cursor: pointer;
            user-select: none;
        }

        span.ButtonStyleGreen:hover {
            animation: 0.5s buttonStyleGreen;
            animation-fill-mode: forwards;
        }

        @keyframes buttonStyleBlue {
            0% {
                
            }

            100% {
                background-color: #18dcff;
                color: #ffffff;
            }
        }

        @keyframes buttonStyleRed {
            0% {

            }
            
            100% {
                background-color: #d30707;
                color: #ffffff;
            }
        }

        @keyframes buttonStyleYellow {
            0% {

            }

            100% {
                background-color: #f0ec1a;
                color: #ffffff;
            }
        }

        @keyframes buttonStyleGreen {
            0% {

            }

            100% {
                background-color: #75fc1b;
                color: #ffffff;
            }
        }
    </style>
</head>
<body>
    <span class="ButtonStyleBlue">Button</span>
    <span class="ButtonStyleRed">Button</span>
    <span class="ButtonStyleYellow">Button</span>
    <span class="ButtonStyleGreen">Button</span>

</body>
</html>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-01-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档