How to create Ripple effect on Click - Material Design

后端 未结 10 1564
南旧
南旧 2020-12-12 11:17

I\'m new to CSS animations and I\'ve been trying to make their animation work for the last hours by looking at their code, but I can\'t make it work for now.

I\'m ta

10条回答
  •  醉话见心
    2020-12-12 12:00

    This can be achieved with box-shadows. The positioning of the circle origin under the mouse when clicked will need JS.

    li{
        font-size:2em;
        background:rgba(51, 51, 254, 0.8);
        list-style-type:none;
        display:inline-block;
        line-height:2em;
        width:6em;
        text-align:center;
        color:#fff;
        position:relative;
        overflow:hidden;
    }
    a{color:#fff;}
    a:after{
        content:'';
        position:absolute;
        border-radius:50%;
        height:10em; width:10em;
        top: -4em; left:-2em;
        box-shadow: inset 0 0 0 5em rgba(255,255,255,0.2);
        transition: box-shadow 0.8s;
    }
    a:focus:after{
        box-shadow: inset 0 0 0 0em rgba(255,255,255,0.2);
    }

提交回复
热议问题