AI CSS Animations

Marquee Lights Text

Letters light up in the chase pattern of a theater marquee: every third bulb on, stepping along the sign. The delay is the letter index times one step, so any word chases without extra CSS.

Also known as: chasing lights text, theater marquee text, light bulb letters.

HTML

<div class="txt-marquee-lights-text" aria-label="Showtime"><span aria-hidden="true"><span style="--i: 0">S</span><span style="--i: 1">H</span><span style="--i: 2">O</span><span style="--i: 3">W</span><span style="--i: 4">T</span><span style="--i: 5">I</span><span style="--i: 6">M</span><span style="--i: 7">E</span></span></div>

CSS

.txt-marquee-lights-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;
  display: inline-block;
  padding: 0.25em 0.5em;
  color: var(--c);
  letter-spacing: 0.08em;
  border: 0.12em dotted color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 0.3em;}
.txt-marquee-lights-text span span {
  display: inline-block;
  color: color-mix(in srgb, var(--c) 40%, transparent);
  animation: txt-marquee-lights-text-chase 0.9s linear infinite;
  /* one 0.3s step per letter; minus three cycles so all are running on load */
  animation-delay: calc(var(--i) * 0.3s - 2.7s);
}
@keyframes txt-marquee-lights-text-chase {
  0%, 30%, 100% { color: var(--c); text-shadow: 0 0 0.3em color-mix(in srgb, var(--c) 70%, transparent); }
  36%, 94%      { color: color-mix(in srgb, var(--c) 40%, transparent); text-shadow: 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .txt-marquee-lights-text, .txt-marquee-lights-text *, .txt-marquee-lights-text::before, .txt-marquee-lights-text::after, .txt-marquee-lights-text *::before, .txt-marquee-lights-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