The tinted button fills with the accent on hover, then its background keeps throbbing gently while the pointer stays, like a record light. The pulse waits half a second, so the fill lands first.
Also known as: hvr-back-pulse, pulsing background button, recording button hover css.
<button class="hfx-back-pulse"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg>Start recording</button>
.hfx-back-pulse {
--c: var(--hfx-color, #3b82f6);
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 0.7em 1.6em;
border-radius: 0.5em;
font: 600 var(--hfx-size, 16px) system-ui, sans-serif;
cursor: pointer;
border: 0;
background: color-mix(in srgb, var(--c) 14%, transparent);
color: var(--c);
transition: background-color 0.4s ease, color 0.4s ease;}
.hfx-back-pulse svg {
width: 1.1em;
height: 1.1em;
}
.hfx-back-pulse:is(:hover, :focus-visible) {
background: var(--c);
color: #fff;
animation: hfx-back-pulse-throb 1s ease-in-out 0.5s infinite;
}
@keyframes hfx-back-pulse-throb {
50% { background-color: color-mix(in srgb, var(--c) 72%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
.hfx-back-pulse, .hfx-back-pulse *, .hfx-back-pulse::before, .hfx-back-pulse::after, .hfx-back-pulse *::before, .hfx-back-pulse *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.