css藉助僞元素實現水波效果

不BB,上代碼,拉走看

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style>
.btn {
    margin: 100px auto;
    width: 100px;
    height: 50px;
    position: relative;
    overflow: hidden;
    background: #e3e3e3;
    border-radius: 5px;
    cursor: pointer;
}
.btn:after {
    content: '';
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: absolute;
    left: -50px;
    top: -75px;
    opacity: 0;
    transition: all .6s;
    background: linear-gradient(to right bottom,#46a4f5,#65cdf4);
}
.btn:active:after{
    width: 0;
    left: 50px;
    top: -50px;
    transition-duration: 0s;
    opacity: 1;
}
</style>
</head>
<body>
    <div class="btn"></div>
</body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章