第四章 web前端开发工程师--JavaScript京东商城项目开发 4-4 波纹效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>波纹效果</title>
    <style>
        .button{
            position: relative;
            background-color: #4CAF50;
            border: none;
            font-size: 28px;
            color: #FFFFFF;
            width: 200px;
            padding: 20px;
            text-align: center; 
            /* 指定过渡完成的时间 */
            transition-duration: 0.4s;  
            text-decoration: none;
            /* 递归隐藏 */
            overflow: hidden;
            cursor: pointer;
        }
        .button:after{
            content:  "";
            background: #90EE90;
            display: block;
            position: absolute;
            padding-top: 300%;
            padding-left: 350%;
            margin-left: -20px!important;
            margin-top:-120%;
            opacity: 0;
            transition: all 0.8s;
        }
        .button:active:after{
            padding: 0;
            margin: 0;
            opacity: 1;
            transition: 0s;
        }
        .btn{
            display: inline-block;
            border: none;
            color:#fff;
            background:#f4511e;
            text-align: center;
            font-size: 28px;
            width: 200px;
            cursor: pointer;
            position: relative;
        }
        .btn:after{
            content: ">>";
            position: absolute;
            top:0;
            right: -20px;
            transition: 0.5s;
        }
    </style>
</head>
<body>
    <button class="button">click me</button>
    <button class="btn">JOVER</button>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/wgf5845201314/article/details/91878188