CSS3 动画按钮

<!DOCTYPE html>

<html lang="zh-CN">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>CSS3 动画按钮</title>

    <style>

        body {

            font-family: 'Arial', sans-serif;

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100vh;

            background-color: #f5f5f5;

            margin: 0;

        }

       

        .button-container {

            text-align: center;

        }

       

        .animated-button {

            position: relative;

            display: inline-block;

            padding: 15px 30px;

            color: #fff;

            background: linear-gradient(45deg, #ff3366, #ba265d);

            border: none;

            border-radius: 50px;

            font-size: 18px;

            font-weight: bold;

            text-transform: uppercase;

            letter-spacing: 1px;

            cursor: pointer;

            overflow: hidden;

            box-shadow: 0 5px 15px rgba(186, 38, 93, 0.4);

            transition: all 0.3s ease;

        }

       

        .animated-button:hover {

            transform: translateY(-3px);

            box-shadow: 0 8px 20px rgba(186, 38, 93, 0.6);

        }

       

        .animated-button:active {

            transform: translateY(1px);

        }

       

        .animated-button::before {

            content: '';

            position: absolute;

            top: 0;

            left: -100%;

            width: 100%;

            height: 100%;

            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);

            transition: 0.5s;

        }

       

        .animated-button:hover::before {

            left: 100%;

        }

       

        .animated-button span {

            position: relative;

            z-index: 1;

        }

       

        /* 脉冲动画 */

        @keyframes pulse {

            0% {

                transform: scale(1);

                opacity: 1;

            }

            50% {

                transform: scale(1.05);

                opacity: 0.8;

            }

            100% {

                transform: scale(1);

                opacity: 1;

            }

        }

       

        .pulse-button {

            animation: pulse 2s infinite;

        }

       

        /* 旋转动画 */

        .rotate-button {

            transition: transform 0.5s ease;

        }

       

        .rotate-button:hover {

            transform: rotate(360deg);

        }

       

        /* 边框动画 */

        .border-button {

            background: transparent;

            color: #ff3366;

            border: 2px solid #ff3366;

            transition: all 0.3s ease;

        }

       

        .border-button:hover {

            background: #ff3366;

            color: white;

        }

       

        /* 更多信息链接 */

        .info-link {

            display: block;

            margin-top: 30px;

            color: #666;

            text-decoration: none;

            font-size: 14px;

            transition: color 0.3s;

        }

       

        .info-link:hover {

            color: #ff3366;

        }

    </style>

</head>

<body>

    <div class="button-container">

        <button class="animated-button">

            <span>点击按钮</span>

        </button>

       

        <button class="animated-button pulse-button" style="margin-left: 20px;">

            <span>脉冲效果</span>

        </button>

       

        <button class="animated-button rotate-button" style="margin-left: 20px; background: linear-gradient(45deg, #3498db, #2980b9); box-shadow: 0 5px 15px rgba(41, 128, 185, 0.4);">

            <span>旋转效果</span>

        </button>

       

        <button class="animated-button border-button" style="margin-left: 20px; box-shadow: none;">

            <span>边框动画</span>

        </button>

       

    </div>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值