AI CSS Animations

Glow In Text Effect

Letters switch on one by one as bright, glowing shapes, then cool down to the plain text color as the bloom fades. The glow is a two-layer text-shadow that shrinks to nothing.

Also known as: glowing text reveal, light up letters css, letters glow in.

Lights on

HTML

<div class="txt-glow-in-text" aria-label="Lights on"><span style="--i: 0">L</span><span style="--i: 1">i</span><span style="--i: 2">g</span><span style="--i: 3">h</span><span style="--i: 4">t</span><span style="--i: 5">s</span><span style="--i: 6">&nbsp;</span><span style="--i: 7">o</span><span style="--i: 8">n</span></div>

CSS

.txt-glow-in-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c);
  white-space: nowrap;}
.txt-glow-in-text span {
  animation: txt-glow-in-text-on 1.3s ease-out calc(var(--i) * 110ms) both;
}
@keyframes txt-glow-in-text-on {
  0% {
    opacity: 0;
    color: color-mix(in srgb, var(--c) 35%, #fff);
    text-shadow: 0 0 0.08em var(--c), 0 0 0.5em var(--c);
  }
  20% {
    opacity: 1;
    color: color-mix(in srgb, var(--c) 35%, #fff);
    text-shadow: 0 0 0.08em var(--c), 0 0 0.5em var(--c);
  }
  100% {
    opacity: 1;
    color: var(--c);
    text-shadow: 0 0 0 transparent, 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .txt-glow-in-text, .txt-glow-in-text *, .txt-glow-in-text::before, .txt-glow-in-text::after, .txt-glow-in-text *::before, .txt-glow-in-text *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations