The shape of what is coming, built from exactly three primitives: a block, a line
and a dot. The sweep is one background-position animation, so a screen of these costs
nothing on the main thread. It does not appear at all for the first 220ms, because a skeleton that
flashes is worse than a blank moment.
.sk-block — media
.sk-line — text. The last
line is short, like a real last line
.sk-dot — an avatar
.sk{
background:
linear-gradient(90deg, var(--skel-base) 0%, var(--skel-sheen) 45%,
var(--skel-base) 90%) 0 0 / 300% 100% no-repeat;
animation: sweep 1400ms linear infinite;
border-radius: 10px;
}
@keyframes sweep{ from{ background-position:100% 0 } to{ background-position:-100% 0 } }
.sk-block{ aspect-ratio:4/3 } /* media */
.sk-line { height:11px; width:var(--w,100%); border-radius:999px } /* text */
.sk-dot { width:34px; height:34px; border-radius:999px } /* avatar */
@media (prefers-reduced-motion:reduce){
.sk{ animation:none; background:var(--skel-base) } /* shape stays */
}The sheen comes off the container scale, not from white. White is correct on a light surface and a glare on a dark one, and this is the single most common reason a skeleton looks wrong in dark mode.