原文链接:使用CSS实现按钮点击波纹效果
这种的相对来说比较简单,而且在点击时没有根据鼠标移入位置开始出现水波扩散效果。
html:
<div class="button">我是个button</div>
css:
.button {
width: 100px;
height: 50px;
border-radius: 10px;
line-height: 50px;
text-align: center;
border: 1px solid red;
position: relative;
overflow: hidden;
}
.btnSpe {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.button:after {
content: "";
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
background-image: radial-gradient(circle, #666 10%, transparent 10.01%);
background-repeat: no-repeat;
background-position: 50%;
transform: scale(10, 10);
opacity: 0;
transition: transform 0.3s, opacity 0.5s;
}
.button:active:after {
transform: scale(0, 0);
opacity: 0.3;
transition: 0s;
}