Skeleton loading screens in pure CSS

Grey shapes where the content will land, with a soft shine passing over them. They show people what is coming while it loads.

UI loop

Skeleton screens, pure CSS

Loading the article
Loading messages
Sundry Millsundrymill.com/library
Skeleton loading screens in pure CSS

Everything in the preview is live. Try it.

The code, one by one

Shared: the bones and the shimmer
.sk {
  --bone: #E7E2D9;
  --shine: #F6F2EB;
  position: relative;
  display: grid;
  gap: 10px;
  width: min(100%, 300px);
  padding: 14px;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(23, 32, 44, .06), 0 10px 24px -18px rgba(23, 32, 44, .45);
}
.sk-bone {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bone) 40%, var(--shine) 50%, var(--bone) 60%) 0 0 / 300% 100%;
  animation: sk-shine 1.6s linear infinite;
}
.sk-short { width: 55%; }
@keyframes sk-shine {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
/* the words a screen reader hears while the shapes are on screen */
.sk-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .sk-bone { animation: none; }
}

Card

An image, a title and two lines of text: the shape of a blog or product card.

HTML
<div class="sk sk-card" role="status">
  <span class="sk-hidden">Loading the article</span>
  <span class="sk-bone sk-media" aria-hidden="true"></span>
  <span class="sk-bone sk-title" aria-hidden="true"></span>
  <span class="sk-bone" aria-hidden="true"></span>
  <span class="sk-bone sk-short" aria-hidden="true"></span>
</div>
CSS
.sk-card .sk-media { height: auto; aspect-ratio: 5 / 2; border-radius: 10px; }
.sk-card .sk-title { height: 16px; width: 75%; }

List rows

A round avatar and two lines per row, for messages, comments or contacts.

HTML
<div class="sk sk-list" role="status">
  <span class="sk-hidden">Loading messages</span>
  <div class="sk-row" aria-hidden="true"><span class="sk-bone sk-avatar"></span><span class="sk-lines"><span class="sk-bone"></span><span class="sk-bone sk-short"></span></span></div>
  <div class="sk-row" aria-hidden="true"><span class="sk-bone sk-avatar"></span><span class="sk-lines"><span class="sk-bone"></span><span class="sk-bone sk-short"></span></span></div>
</div>
CSS
.sk-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 12px; }
.sk-row .sk-avatar { width: 40px; height: 40px; border-radius: 50%; }
.sk-lines { display: grid; gap: 8px; }

Pulse

The same bones with a slow fade instead of a moving shine. Calmer, for a dashboard that loads several panels at once.

HTML
<div class="sk sk-pulse" role="status">
  <span class="sk-hidden">Loading your stats</span>
  <span class="sk-bone sk-stat" aria-hidden="true"></span>
  <span class="sk-bone sk-short" aria-hidden="true"></span>
</div>
CSS
.sk-pulse .sk-bone {
  background: var(--bone);
  animation: sk-pulse 1.8s ease-in-out infinite;
}
.sk-pulse .sk-stat { height: 28px; width: 40%; }
@keyframes sk-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .sk-pulse .sk-bone { animation: none; }
}

How to use it

  • Every skeleton needs the shared CSS plus its own block. Draw the bones to match the real layout: same heights, same gaps, same image ratio, so nothing jumps when the content arrives.
  • Each skeleton has role="status" and a hidden line such as "Loading messages". The shapes themselves carry aria-hidden, so a screen reader hears one sentence instead of nothing.
  • The shine is a gradient three times as wide as the bone, moved with background-position. It is linear because it never stops, and it switches off for anyone who asks for reduced motion.
  • Replace the whole skeleton with the real content in one go. Swapping it piece by piece looks like the page is breaking.

When to use it

  • A page or panel that takes between about one and ten seconds to fill: a feed, search results, a dashboard, a product grid. Nielsen Norman Group draws the same lines: under a second needs nothing, and past ten seconds people need a progress bar that shows how far along it is.
  • Content whose shape you already know. A skeleton promises a layout, so it only works when the cards, rows or stats that arrive look like the bones that were there.
  • Not for a button press or a small save. A spinner or a short label ("Saving") on the button itself fits a single action better than a page of grey shapes.

A worked example: a message list that loads from an API

An inbox that fetches messages when it opens. The list rows skeleton holds the space until the data comes back.

  1. Put the List rows skeleton in the list's place in the HTML, so it shows on the first paint with no script needed.
  2. Wait about 300 milliseconds before showing it if the data is often quick. A fast answer then never flashes grey shapes at all.
  3. When the fetch resolves, replace the skeleton with the real rows in one step, and set aria-busy="false" on the list if you marked it busy.
  4. If the fetch fails, swap the skeleton for a short message and a Try again button. A shimmer that runs forever tells people the page is still working when it has given up.
Swap the skeleton for the rows
const list = document.querySelector('#messages');
const res = await fetch('/api/messages');
if (res.ok) {
  const rows = await res.json();
  list.replaceChildren(...rows.map(renderRow)); // renderRow is your own
} else {
  list.innerHTML = '<p>Could not load your messages. <button type="button">Try again</button></p>';
}

Showing an interaction like this to a client or in a tutorial? Framok records your screen and zooms in on every click for you.

Source: Nielsen Norman Group, Skeleton Screens 101 (2023, reviewed 2026), which recommends skeletons for full page loads under about 10 seconds and nothing at all under 1 second.

Free to use in personal and commercial work. No credit needed, though a link back is always nice.

More from the library

See the whole library