Skip to content
Guest
Learn CSS · Course Syllabus Show lessons
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

PropertyWhat it controlsCommon values
justify-contentAlignment along the main axisflex-start, center, space-between
align-itemsAlignment along the cross axisstretch, center, flex-start
gapSpace between flex items8px, 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.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind