A worked example, rendered from real sample data. Sign in to run the tool on your own input.
ripple.btn-ripple {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 24px;
border: 0;
border-radius: 10px;
background: #3b82f6;
color: #ffffff;
font: 600 15px/1 system-ui, sans-serif;
cursor: pointer;
transition: background-color 260ms ease;
position: relative;
overflow: hidden;
}
.btn-ripple::after {
content: "";
position: absolute;
left: 50%;
top: 50%;
width: 8px;
height: 8px;
margin: -4px 0 0 -4px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.55);
transform: scale(0);
opacity: 0;
}
.btn-ripple:active {
background: color-mix(in srgb, #3b82f6 85%, black);
}
.btn-ripple:focus-visible {
outline: 2px solid #3b82f6;
outline-offset: 3px;
}
@keyframes btn-ripple {
to { transform: scale(28); opacity: 0; }
}
.btn-ripple:active::after {
animation: btn-ripple 600ms linear;
}
.btn-ripple:disabled,
.btn-ripple[aria-disabled="true"] {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
@media (prefers-reduced-motion: reduce) {
.btn-ripple, .btn-ripple::before, .btn-ripple::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* HTML: <button class="btn-ripple" type="button">Click me</button> */
/* Note: The ripple is purely CSS and starts from the centre. For a pointer-anchored ripple set --x/--y from a JS pointerdown handler. */
Generate animated button styles with ripple, glow, and morphing effects. Part of the DevTools Surf developer suite. Browse more tools in the Animation / CSS collection.