Back to buttons

Live preview

Preview settings

Changes appear as you type. Use Tab to test keyboard focus.

⌘ / Ctrl + S saves locally

Button Ripple Effect

HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.

By @lakhan06

Remix button

Button submission checks

Checks will appear after the preview updates.

Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.

Accessibility quick check

Waiting for the rendered preview…

Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.

Explore freely here. Remix to publish your version with credit to the creator.

About Button Ripple Effect

Button Ripple Effect is an animated CSS button by @lakhan06. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.

Effects and categories
Hover effects
Using this example
Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.

Usage, Tailwind and licensing questions

Read the source files

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Button Ripple Effect</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <a href="#" class="btn"><span>Button</span></a>
    <script src="script.js"></script>
  </body>
</html

CSS


body {
    margin: 0;
    display: flex;
    justify-content: center;
    height: 100vh;
    align-items: center;
    background-color: aliceblue;
    font-family: sans-serif;
  }
  
  .btn {
    background-color: pink;
    padding: 20px 40px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    color: black;
    position: relative;
    overflow: hidden;
  }
  
  .btn span {
    position: relative;
    z-index: 1;
  }
  
  .btn::before {
    content: "";
    position: absolute;
    background-color: orangered;
    width: 0;
    height: 0;
    left: var(--xPos);
    top: var(--yPos);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    transition: width 0.5s, height 0.5s;
  }
  
  .btn:hover::before {
    width: 300px;
    height: 300px;
  }

JavaScript

const btnE1=document.querySelector(".btn");

btnE1.addEventListener("mouseover", (event)=>{
    const x= (event.pageX-btnE1.offsetLeft);
    const y= (event.pageY-btnE1.offsetTop);

    btnE1.style.setProperty("--xPos", x+"px");
    btnE1.style.setProperty("--yPos", y+"px");

})