A three-by-three grid of squares that collapse and reappear in a diagonal sweep. Dense and satisfying, best at medium sizes where the grid is legible.
Also known as: SpinKit cube grid, nine squares loader.
<div class="ldr-cube-grid" role="status" aria-label="Loading"> <span></span><span></span><span></span> <span></span><span></span><span></span> <span></span><span></span><span></span> </div>
.ldr-cube-grid {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: calc(var(--s) / 24);
width: var(--s);
height: var(--s);
}
.ldr-cube-grid span {
background: var(--c);
animation: ldr-cube-grid-scale 1.3s ease-in-out infinite;
}
.ldr-cube-grid span:nth-child(1) { animation-delay: 0.2s; }
.ldr-cube-grid span:nth-child(2) { animation-delay: 0.3s; }
.ldr-cube-grid span:nth-child(3) { animation-delay: 0.4s; }
.ldr-cube-grid span:nth-child(4) { animation-delay: 0.1s; }
.ldr-cube-grid span:nth-child(5) { animation-delay: 0.2s; }
.ldr-cube-grid span:nth-child(6) { animation-delay: 0.3s; }
.ldr-cube-grid span:nth-child(7) { animation-delay: 0s; }
.ldr-cube-grid span:nth-child(8) { animation-delay: 0.1s; }
.ldr-cube-grid span:nth-child(9) { animation-delay: 0.2s; }
@keyframes ldr-cube-grid-scale {
0%, 70%, 100% { transform: scale(1); }
35% { transform: scale(0); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-cube-grid, .ldr-cube-grid *, .ldr-cube-grid::before, .ldr-cube-grid::after {
animation-duration: 3s;
}
}--ldr-color on the element or a parent.
Currently previewing #3b82f6.--ldr-size. Every dimension in the snippet is
derived from it. Currently previewing 64px.animation shorthand.
Delays on the children are relative, so they keep their rhythm.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.