1. 程式人生 > 其它 >css 按鈕動畫

css 按鈕動畫

技術標籤:Csscss佈局和動畫模板

效果圖:

程式碼:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            background: #aaa;
        }
        .button_animate{
            position:relative;
            overflow:hidden;
            z-index:1;
            background:#FFF;
            border-radius:2px;
            padding:0.5em 1em;
            box-shadow:0 0 10px 1px #f3f3f3;
            border:none;
            outline:none;
        }
        .button_animate:before{
            content:'';
            z-index:-1;
            position:absolute;
            top:0;
            left:0;
            width:1em;
            height:1em;
            border-radius:50%;
            transform-origin:center;
            transform:scale3d(0, 0, 0);
            transition:all 0.45s ease-in-out;
            background:green;
        }
        .button_animate:hover{
            color:#FFF;
        }
        .button_animate:hover:before{
            transform:scale3d(15, 15, 15);
        }
    </style>
</head>
<body>
    <button class="button_animate">元件配置</button>
</body>
</html>