AI CSS Animations

Box Shadow Glow Spinner

Eight glowing dots from one empty div: each dot is a box-shadow offset around the center, the leading two carry a blurred glow, and the element turns in eight clicks. No pseudo-elements.

Also known as: single div spinner, one element loader, css box-shadow loader.

HTML

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

CSS

.ldr-box-shadow-spinner {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  --d: calc(var(--s) / 7);
  --r: calc(var(--s) * 0.38);
  --q: calc(var(--s) * 0.269);
  width: var(--d);
  height: var(--d);
  margin: calc((var(--s) - var(--d)) / 2);
  border-radius: 50%;
  box-shadow:
    0 calc(var(--r) * -1) calc(var(--s) / 6) 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 70%, transparent),
    calc(var(--q) * -1) calc(var(--q) * -1) calc(var(--s) / 8) 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 40%, transparent),
    0 calc(var(--r) * -1) 0 0 var(--c),
    calc(var(--q) * -1) calc(var(--q) * -1) 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 80%, transparent),
    calc(var(--r) * -1) 0 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 62%, transparent),
    calc(var(--q) * -1) var(--q) 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 46%, transparent),
    0 var(--r) 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 34%, transparent),
    var(--q) var(--q) 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 24%, transparent),
    var(--r) 0 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 17%, transparent),
    var(--q) calc(var(--q) * -1) 0 0 color-mix(in srgb, var(--ldr-color, #3b82f6) 12%, transparent);
  animation: ldr-box-shadow-spinner-spin 0.9s steps(8) infinite;
}
@keyframes ldr-box-shadow-spinner-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-box-shadow-spinner, .ldr-box-shadow-spinner *, .ldr-box-shadow-spinner::before, .ldr-box-shadow-spinner::after, .ldr-box-shadow-spinner *::before, .ldr-box-shadow-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="m-5 h-[7px] w-[7px] animate-spin rounded-full [animation-duration:0.9s] [animation-timing-function:steps(8)] shadow-[0_-18px_8px_0_rgba(59,130,246,0.7),-13px_-13px_6px_0_rgba(59,130,246,0.4),0_-18px_0_0_#3b82f6,-13px_-13px_0_0_rgba(59,130,246,0.8),-18px_0_0_0_rgba(59,130,246,0.62),-13px_13px_0_0_rgba(59,130,246,0.46),0_18px_0_0_rgba(59,130,246,0.34),13px_13px_0_0_rgba(59,130,246,0.24),18px_0_0_0_rgba(59,130,246,0.17),13px_-13px_0_0_rgba(59,130,246,0.12)]" 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