<div class="container text-center">
        <button class="btn btn-default ripple btn-lg">Button</button>
        <button class="btn btn-default ripple btn-lg">Button with very long content</button>
</div>
.ripple {
    position: relative;
/*     此处不需要设置overflow:hidden,因为after元素需要溢出显示 */
}
.ripple:focus{
    outline: none;
}

.ripple:after {
    content: "";
    display: block;
    position: absolute;
/*     扩大伪类元素4个方向各10px */
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    pointer-events: none;
    background-color: #333;
    background-repeat: no-repeat;
    background-position: 50%;
    opacity: 0;
    transition: all .3s;
}

.ripple:active:after {
    opacity: .3;
/*     设置初始状态 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0s;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.