AI CSS Animations

Bars Loader

Five vertical bars stretch and shrink like an audio equalizer. Great for media players, voice input, and anything that is 'processing' rather than 'fetching'.

HTML

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

CSS

.ldr-bars {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: flex;
  align-items: center;
  gap: calc(var(--s) / 12);
  height: var(--s);
}
.ldr-bars span {
  width: calc(var(--s) / 8);
  height: 100%;
  border-radius: calc(var(--s) / 24);
  background: var(--c);
  animation: ldr-bars-stretch 1.2s ease-in-out infinite;
}
.ldr-bars span:nth-child(2) { animation-delay: -1.1s; }
.ldr-bars span:nth-child(3) { animation-delay: -1.0s; }
.ldr-bars span:nth-child(4) { animation-delay: -0.9s; }
.ldr-bars span:nth-child(5) { animation-delay: -0.8s; }
@keyframes ldr-bars-stretch {
  0%, 40%, 100% { transform: scaleY(0.4); }
  20%           { transform: scaleY(1); }
}

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

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