Lesson 5 of 10
Loading Spinners & Skeleton Screens
Loading indicators show users that content is being fetched. CSS-only loading spinners are lightweight (no images/JS needed), and skeleton screens provide a smoother perceived loading experience than traditional spinners.
Loading Patterns
- Spinning circle - border with transparent side + rotate animation. The classic loading spinner
- Pulsing dot - scale() animation on dots with staggered delays
- Progress bar - Width animation from 0% to 100% with gradient background
- Skeleton screen - Gray placeholder blocks with shimmer animation mimicking content layout
- Shimmer effect - linear-gradient moving across skeleton elements via background-position animation
- Why skeleton > spinner - Skeleton screens reduce perceived wait time because they show the expected layout
Mini-Build: Loading Animations
Tip
The CSS-only spinner is a 3-line technique: a div with border: 4px solid rgba(255,255,255,0.1) (faint full ring), border-top: 4px solid #667eea (the colored arc), border-radius: 50% (circle), and animation: spin 0.8s linear infinite. That's it - no SVG, no images, no JavaScript.
Skeleton screens reduce perceived loading time by communicating upcoming layout structure
Common Mistake
Using animation-timing-function: ease for a rotating spinner. Ease speeds up then slows down, creating a rhythmic pulsing instead of a smooth rotation. Always use animation-timing-function: linear for spinners - constant speed looks mechanical and correct.
Practice Task
Build 3 loading states in the editor: (1) A CSS spinner (border-top trick + linear rotation), (2) 3 pulsing dots with staggered animation-delay: 0s, 0.2s, 0.4s, (3) A skeleton card that mimics a real card layout (image area + 3 text lines) using the shimmer animation from the editor above.
Quick Quiz
Key Takeaways
- Loading indicators show users that content is being fetched.
- Spinning circle - border with transparent side + rotate animation. The classic loading spinner
- Pulsing dot - scale() animation on dots with staggered delays
- Progress bar - Width animation from 0% to 100% with gradient background
Finished this lesson?