Dots enter from nothing on the left, swell to full size in the middle and shrink away on the right, a steady conveyor with no start or end. Position is linear; only the size is eased.
Also known as: conveyor dots loader, scrolling dots, dots moving left to right.
<div class="ldr-marching-dots" role="status" aria-label="Loading"> <span></span><span></span><span></span><span></span><span></span> </div>
.ldr-marching-dots {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
--d: calc(var(--s) / 4);
position: relative;
width: calc(var(--s) * 1.7);
height: var(--d);
}
.ldr-marching-dots span {
position: absolute;
top: 0;
left: 0;
width: var(--d);
height: var(--d);
animation: ldr-marching-dots-move 1.5s linear infinite;
}
.ldr-marching-dots span::before {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
background: var(--c);
animation: ldr-marching-dots-size 0.75s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
}
.ldr-marching-dots span:nth-child(2),
.ldr-marching-dots span:nth-child(2)::before { animation-delay: -0.3s; }
.ldr-marching-dots span:nth-child(3),
.ldr-marching-dots span:nth-child(3)::before { animation-delay: -0.6s; }
.ldr-marching-dots span:nth-child(4),
.ldr-marching-dots span:nth-child(4)::before { animation-delay: -0.9s; }
.ldr-marching-dots span:nth-child(5),
.ldr-marching-dots span:nth-child(5)::before { animation-delay: -1.2s; }
@keyframes ldr-marching-dots-move {
from { transform: translateX(0); }
to { transform: translateX(calc(var(--s) * 1.7 - var(--d))); }
}
@keyframes ldr-marching-dots-size {
from { transform: scale(0); }
to { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-marching-dots, .ldr-marching-dots *, .ldr-marching-dots::before, .ldr-marching-dots::after, .ldr-marching-dots *::before, .ldr-marching-dots *::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.