AI CSS Animations

Two Color Neon Sign Text

Two neon words that take turns: both burn, one stutters off, the other hands over, then both come back. The second color is your accent pushed round the color wheel with hue-rotate.

Also known as: pink and blue neon text, alternating neon sign, dual color neon css.

LIVE MUSIC

HTML

<div class="txt-two-color-neon"><span class="txt-two-color-neon-a">LIVE</span> <span class="txt-two-color-neon-b">MUSIC</span></div>

CSS

.txt-two-color-neon {
  --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: flex;
  gap: 0.4em;
  font-style: italic;
  letter-spacing: 0.08em;}
.txt-two-color-neon-a,
.txt-two-color-neon-b {
  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);
  animation: 4s steps(1, end) infinite;
}
.txt-two-color-neon-a {
  filter: hue-rotate(115deg);
  animation-name: txt-two-color-neon-a;
}
.txt-two-color-neon-b {
  animation-name: txt-two-color-neon-b;
}
@keyframes txt-two-color-neon-a {
  0%, 64%, 88%, 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); }
  60%, 62%, 66% { color: color-mix(in srgb, var(--c) 28%, transparent); text-shadow: none; }
}
@keyframes txt-two-color-neon-b {
  0%, 30%, 34%, 60%, 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); }
  32%, 36% { color: color-mix(in srgb, var(--c) 28%, transparent); text-shadow: none; }
}

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