Course contentsShow
← Web Development
Lesson 2035 of 2,98237. Image and Asset OptimizationFree lesson

Skeleton Screens for Content

Create animated placeholder UI with CSS gradients or SVG to indicate loading state for text and images.

Skeleton Screens for Content

You'll learn how to create animated placeholder UI that mimics the layout of your content while it loads, improving perceived performance.

What Are Skeleton Screens?

Instead of showing a spinner or blank space while content loads, skeleton screens display a rough outline of where text blocks, images, and other elements will appear. Think of it like a wireframe that gradually "fills in" with real content—users see that something is happening, which makes the wait feel shorter.

The key is adding subtle animation (usually a shimmer or pulse effect) to signal that the page is actively loading, not frozen.

Creating Animated Skeletons with CSS

You can build skeleton screens using simple HTML elements styled with background gradients that animate across them:

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-image {
  height: 200px;
  width: 100%;
}
<div class="skeleton skeleton-image"></div>
<div class="skeleton skeleton-text"></div>
<div class="skeleton skeleton-text" style="width: 80%;"></div>

The gradient moves from left to right repeatedly, creating the illusion of a "shine" passing over placeholder elements. When your actual content loads, you replace these skeleton divs with the real images and text.

Why This Matters

Skeleton screens match your content's structure, setting accurate expectations. Users understand what's coming and feel less frustrated than staring at a blank screen or generic spinner.

Key Takeaway: Skeleton screens use animated CSS gradients to create layout-aware loading placeholders that improve perceived performance and user experience during content loading.