AI CSS Animations

Neon Glow Pulse Text

Soft neon that breathes: a blurred copy of the word behind it swells and fades on a slow cycle. Only the copy's opacity and scale animate, so the glow is cheap even at large sizes.

Also known as: glowing text css, pulsing glow text, glow text animation.

After Dark

HTML

<div class="txt-neon-glow-pulse" data-text="After Dark">After Dark</div>

CSS

.txt-neon-glow-pulse {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  isolation: isolate;
  color: color-mix(in srgb, var(--c) 30%, #fff);
  letter-spacing: 0.03em;
  text-shadow: 0 0 0.01em var(--c), 0 0 0.03em var(--c), 0 0 0.1em var(--c);}
.txt-neon-glow-pulse::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--c);
  filter: blur(0.22em);
  opacity: 0.2;
  animation: txt-neon-glow-pulse-breathe 2.8s ease-in-out infinite alternate;
}
@keyframes txt-neon-glow-pulse-breathe {
  to { opacity: 1; transform: scale(1.06); }
}

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

Tailwind CSS version

The same effect using Tailwind utility classes. No custom CSS or config needed.

<div class="relative isolate inline-block text-4xl font-bold text-blue-200 [text-shadow:0_0_2px_#fff,0_0_6px_#3b82f6]">
  <span class="absolute inset-0 -z-10 text-blue-500 blur-md animate-pulse" aria-hidden="true">After Dark</span>
  After Dark
</div>

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