The button lights up with a soft halo in its own color and rises a hair. The glow is a box-shadow that transitions from zero, so nothing jumps.
Also known as: glowing button hover, box shadow glow.
<button class="hfx-glow">Launch</button>
.hfx-glow {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
display: inline-flex;
align-items: center;
gap: 0.5em;
padding: 0.7em 1.6em;
border-radius: 0.5em;
font: 600 1em system-ui, sans-serif;
cursor: pointer;
border: 0;
background: var(--c);
color: #fff;
box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 0%, transparent);
transition: box-shadow 0.3s ease, transform 0.3s ease;}
.hfx-glow:hover {
box-shadow: 0 0 1.4em color-mix(in srgb, var(--c) 65%, transparent);
transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
.hfx-glow, .hfx-glow *, .hfx-glow::before, .hfx-glow::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}The same effect using Tailwind utility classes. No custom CSS or config needed.
<button class="rounded-lg bg-blue-500 px-6 py-3 font-semibold text-white transition duration-300 hover:-translate-y-px hover:shadow-[0_0_22px_rgba(59,130,246,0.65)]"> Launch </button>
--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.