AI CSS Animations

Flashing Dots Loader

Three dots fade in and out one after another. Nothing moves or resizes, which makes this the safest dots loader for dense UI and tiny inline spots.

Also known as: fading dots, blinking dots loader.

HTML

<div class="ldr-flashing-dots" role="status" aria-label="Loading">
  <span></span><span></span><span></span>
</div>

CSS

.ldr-flashing-dots {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: flex;
  gap: calc(var(--s) / 8);
}
.ldr-flashing-dots span {
  width: calc(var(--s) / 4);
  height: calc(var(--s) / 4);
  border-radius: 50%;
  background: var(--c);
  animation: ldr-flashing-dots-fade 1s ease-in-out infinite;
}
.ldr-flashing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ldr-flashing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ldr-flashing-dots-fade {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-flashing-dots, .ldr-flashing-dots *, .ldr-flashing-dots::before, .ldr-flashing-dots::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="flex gap-1.5" role="status" aria-label="Loading">
  <span class="h-3 w-3 animate-pulse rounded-full bg-blue-500"></span>
  <span class="h-3 w-3 animate-pulse rounded-full bg-blue-500 [animation-delay:0.2s]"></span>
  <span class="h-3 w-3 animate-pulse rounded-full bg-blue-500 [animation-delay:0.4s]"></span>
</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