AI CSS Animations

ASCII Line Spinner

One rounded bar ticks through | / - \ in eight hard steps, the command line spinner every terminal user knows. A plain rotation with steps(8) does it, so the Tailwind version is one class.

Also known as: terminal spinner, cli spinner css, pipe slash spinner.

HTML

<div class="ldr-ascii-spinner" role="status" aria-label="Loading"></div>

CSS

.ldr-ascii-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: calc(var(--s) / 8);
  height: calc(var(--s) * 0.8);
  border-radius: var(--s);
  background: var(--c);
  animation: ldr-ascii-spinner-tick 1s steps(8) infinite;
}
@keyframes ldr-ascii-spinner-tick {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-ascii-spinner, .ldr-ascii-spinner *, .ldr-ascii-spinner::before, .ldr-ascii-spinner::after, .ldr-ascii-spinner *::before, .ldr-ascii-spinner *::after {
    animation-duration: 3s;
  }
}

Tailwind CSS version

The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.

<div class="h-10 w-1.5 animate-[spin_1s_steps(8)_infinite] rounded-full bg-blue-500" role="status" aria-label="Loading"></div>

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries role="status" and an aria-label so screen readers announce the wait. The reduced-motion rule at the end slows the animation for users who asked for less motion.

Similar loaders