AI CSS Animations

Blinking Text

Text that switches on and off, hard, with no fade. Use it sparingly and only for things that genuinely need attention, like a live indicator or a recording light.

Also known as: flashing text, blink css, attention text.

HTML

<div class="txt-blink">● LIVE</div>

CSS

.txt-blink {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c);
  letter-spacing: 0.08em;
  animation: txt-blink-flash 1.2s steps(2, start) infinite;}
@keyframes txt-blink-flash {
  to { visibility: hidden; }
}

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