AI CSS Animations

Aurora Text Effect

Teal, green and violet bands drift through the letters while a pink veil drifts the other way, like the northern lights. Each layer is an em-sized tile that loops by exactly one tile.

Also known as: aurora gradient text, northern lights text css, animated aurora text.

Northern Lights

HTML

<div class="txt-aurora-text">Northern Lights</div>

CSS

.txt-aurora-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;
  font-weight: 800;
  letter-spacing: -0.01em;
  background:
    radial-gradient(ellipse 30% 100% at 50% 100%, color-mix(in srgb, #f472b6 80%, transparent), transparent 75%) 0 0 / 5em 100% repeat-x,
    linear-gradient(90deg, color-mix(in srgb, var(--c) 30%, #14b8a6), color-mix(in srgb, var(--c) 20%, #22c55e) 28%, var(--c) 52%, color-mix(in srgb, var(--c) 30%, #a855f7) 76%, color-mix(in srgb, var(--c) 30%, #14b8a6)) 0 0 / 9em 100% repeat-x,
    var(--c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: txt-aurora-text-drift 6s linear infinite;}
@keyframes txt-aurora-text-drift {
  to { background-position: 5em 0, -9em 0; }
}

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