Button Click Ripple Effect #183

CSS JavaScript button click ripple effect animation

Adding these style CSS buttons to your website is easier than you think. Simply copy and paste the CSS code provided with each button design into your stylesheet

Preview Button Style

You can view the default style of buttons, the disabled state mode style of buttons, and the full-width block style of the button here. Some buttons style may not display in full width format

Button style

Disabled style

Full width block style

Button Source Code HTML and CSS

Click the button below to download the source code or edit it live.
To copy this click on the icon at the top right of the code box
Button HTML
<button class="btn-183 ripple-btn">Click me 183</button>
Button CSS
.btn-183 {
    position: relative;
    width: 150px;
    height: 50px;
    border: none;
    background: #167afd;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    z-index: 5;
    /*** full width block ***/
    /* width: 100%; */
}

.btn-183 span {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.5);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: scale_183 0.5s ease-out;
    display: flex;
    z-index: -1;
}

@keyframes scale_183 {
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/*** disabled style ***/
.btn-183:disabled {
    pointer-events: none;
    opacity: .65;
    color: #7e7e7e;
    background: #dcdcdc;
    box-shadow: none;
    text-shadow: none;
}
Button javaScript
(() => {
    const buttons = document.querySelectorAll('.ripple-btn');
    function addCircle(event) {
        let x = event.pageX;
        let y = event.pageY;
        let button_top = this.offsetTop;
        let button_left = this.offsetLeft;
        let left = x - button_left;
        let right = y - button_top;
        let circle = document.createElement('span');
        circle.classList.add('circle');
        circle.style.top = right + 'px';
        circle.style.left = left + 'px';
        this.appendChild(circle);
        setTimeout(() => circle.remove(), 500);
    };
    buttons.forEach(btn => btn.addEventListener('click', addCircle));
})();