AI CSS Animations

Broken Neon Sign Text

A framed neon sign where every tube burns steadily except one letter, which buzzes, cuts out and comes back. Only that letter's span is animated; the rest is static glow.

Also known as: neon sign one letter flickering, motel neon sign, faulty neon text.

HOTEL

HTML

<div class="txt-broken-neon-letter" aria-label="HOTEL"><span style="--i: 0">H</span><span style="--i: 1">O</span><span style="--i: 2">T</span><span style="--i: 3">E</span><span style="--i: 4">L</span></div>

CSS

.txt-broken-neon-letter {
  --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.12em 0.33em 0.12em 0.45em;
  letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--c) 30%, #fff);
  text-shadow: 0 0 0.01em var(--c), 0 0 0.03em var(--c), 0 0 0.1em var(--c), 0 0 0.3em color-mix(in srgb, var(--c) 70%, transparent), 0 0 0.6em color-mix(in srgb, var(--c) 40%, transparent);
  border: 0.06em solid color-mix(in srgb, var(--c) 30%, #fff);
  border-radius: 0.3em;
  box-shadow: 0 0 0.03em var(--c), 0 0 0.12em var(--c), 0 0 0.35em color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 0.03em var(--c), inset 0 0 0.12em var(--c), inset 0 0 0.3em color-mix(in srgb, var(--c) 40%, transparent);}
.txt-broken-neon-letter span:nth-child(4) {
  animation: txt-broken-neon-letter-buzz 3.6s steps(1, end) infinite;
}
@keyframes txt-broken-neon-letter-buzz {
  0%, 6%, 11%, 58%, 62%, 100% { color: color-mix(in srgb, var(--c) 30%, #fff); text-shadow: 0 0 0.01em var(--c), 0 0 0.03em var(--c), 0 0 0.1em var(--c), 0 0 0.3em color-mix(in srgb, var(--c) 70%, transparent), 0 0 0.6em color-mix(in srgb, var(--c) 40%, transparent); }
  4%, 9%, 14%, 60% { color: color-mix(in srgb, var(--c) 28%, transparent); text-shadow: none; }
}

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