Light pools inside the edges of the box and washes inward, then ebbs back to a thin glowing rim. Two inset shadows on pseudo-elements, faded with opacity, so the middle stays clear for content.
Also known as: inner glow effect css, inset box shadow glow, inner shadow border.
<div class="bdr-inner-glow-border">Inner glow</div>
.bdr-inner-glow-border {
--c: var(--bdr-color, #3b82f6);
font-size: var(--bdr-size, 16px);
position: relative;
display: grid;
place-items: center;
width: 15em;
height: 8.5em;
border-radius: 1em;
font-family: system-ui, sans-serif;
font-weight: 600;
--ease: cubic-bezier(0.45, 0, 0.55, 1);
background: color-mix(in srgb, var(--c) 4%, transparent);
}
.bdr-inner-glow-border::before,
.bdr-inner-glow-border::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
}
.bdr-inner-glow-border::before {
box-shadow: inset 0 0 0 1px var(--c), inset 0 0 0.6em color-mix(in srgb, var(--c) 60%, transparent);
animation: bdr-inner-glow-border-rim 3.2s var(--ease) infinite;
}
.bdr-inner-glow-border::after {
box-shadow: inset 0 0 2.4em 0.3em color-mix(in srgb, var(--c) 55%, transparent);
opacity: 0;
animation: bdr-inner-glow-border-wash 3.2s var(--ease) infinite;
}
@keyframes bdr-inner-glow-border-rim {
0%, 100% { opacity: 0.55; }
50% { opacity: 1; }
}
@keyframes bdr-inner-glow-border-wash {
0%, 100% { opacity: 0; }
50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
.bdr-inner-glow-border, .bdr-inner-glow-border *, .bdr-inner-glow-border::before, .bdr-inner-glow-border::after, .bdr-inner-glow-border *::before, .bdr-inner-glow-border *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--bdr-color on the element or a parent.
Currently previewing #3b82f6.--bdr-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.