Soft oval shadows spread from the button's top and bottom edges on hover, like light spilling from a lamp. Two pseudo-elements carry radial gradients centered just outside the button.
Also known as: hvr-shadow-radial, radial glow above and below, light spill button hover.
<button class="hfx-shadow-radial">Open dashboard</button>
.hfx-shadow-radial {
--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: var(--c);
color: #fff;
position: relative;}
.hfx-shadow-radial::before,
.hfx-shadow-radial::after {
content: "";
position: absolute;
left: 0;
right: 0;
height: 1em;
opacity: 0;
transform: scaleX(0.5);
transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
pointer-events: none;
}
.hfx-shadow-radial::before {
bottom: 100%;
background: radial-gradient(ellipse at 50% 150%, color-mix(in srgb, var(--c) 60%, transparent), transparent 70%);
}
.hfx-shadow-radial::after {
top: 100%;
background: radial-gradient(ellipse at 50% -50%, color-mix(in srgb, var(--c) 60%, transparent), transparent 70%);
}
.hfx-shadow-radial:is(:hover, :focus-visible)::before,
.hfx-shadow-radial:is(:hover, :focus-visible)::after {
opacity: 1;
transform: none;
}
@media (prefers-reduced-motion: reduce) {
.hfx-shadow-radial, .hfx-shadow-radial *, .hfx-shadow-radial::before, .hfx-shadow-radial::after, .hfx-shadow-radial *::before, .hfx-shadow-radial *::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.