Layout Systems · 8 min read · Beginner
Flexbox Essentials
Align, space, and wrap items along a single axis using modern CSS Flexbox and gap.
What you'll learn
- Understand the main axis vs. cross axis in Flexbox
- Control spacing with justify-content, align-items, and gap
- Build a responsive navigation bar and card row
Flexbox (display: flex) is designed for laying out items in one dimension, either a horizontal row or a vertical column.
The Three Properties You’ll Use Daily
| Property | What it controls | Common values |
|---|---|---|
justify-content | Alignment along the main axis | flex-start, center, space-between |
align-items | Alignment along the cross axis | stretch, center, flex-start |
gap | Space between flex items | 8px, 1rem, 16px |
Try It Yourself
Change justify-content from space-between to center or flex-end, or switch flex-direction to column!
Interactive Flexbox Playground
Live Result
Check Your Understanding
Score: 0 / 1
1. Which property adds consistent spacing between flex items without extra outer margins?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.