AI CSS Animations

Skeleton Shimmer

Three placeholder lines with a light band sweeping across them. The skeleton screen pattern: show the shape of the content before the content arrives.

Also known as: shimmer placeholder, loading placeholder lines.

HTML

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

CSS

.ldr-skeleton {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: flex;
  flex-direction: column;
  gap: calc(var(--s) / 5);
  width: calc(var(--s) * 5);
}
.ldr-skeleton span {
  height: calc(var(--s) / 4);
  border-radius: calc(var(--s) / 12);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ldr-color, #3b82f6) 12%, transparent) 25%, color-mix(in srgb, var(--ldr-color, #3b82f6) 28%, transparent) 50%, color-mix(in srgb, var(--ldr-color, #3b82f6) 12%, transparent) 75%);
  background-size: 200% 100%;
  animation: ldr-skeleton-shimmer 1.5s ease-in-out infinite;
}
.ldr-skeleton span:nth-child(2) { width: 80%; }
.ldr-skeleton span:nth-child(3) { width: 55%; }
@keyframes ldr-skeleton-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-skeleton, .ldr-skeleton *, .ldr-skeleton::before, .ldr-skeleton::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="w-60 animate-pulse space-y-3" role="status" aria-label="Loading content">
  <div class="h-3 rounded bg-gray-200"></div>
  <div class="h-3 w-4/5 rounded bg-gray-200"></div>
  <div class="h-3 w-3/5 rounded bg-gray-200"></div>
</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