For years, laying out a row of items or centering something both horizontally and vertically took awkward workarounds. Flexbox solved this with a layout model designed for arranging items along a single line — a row or a column — with simple control over spacing, alignment, and how items share the available room. It is now the default tool for navbars, toolbars, card rows, and countless small layout jobs.
This module starts with a beginner tutorial on flex containers and flex items, then focuses on the idea that makes everything click: the main axis and cross axis, and how justify-content and align-items position items along each. It continues with the sizing properties flex-grow, flex-shrink, and flex-basis, which decide how items expand and contract, and finishes with wrapping and gap for layouts that need more than one line.
Watch the lessons in order, then continue on to CSS Grid.
An introduction to using Flexbox to lay out page elements, starting from the idea that Flexbox is a one-dimensional layout model.
The difference between the two key alignment properties: justify-content positions items along the main axis, while align-items positions them along the cross axis.
Explains the powerful properties that control the size of flex container children, and clears up why they can be confusing at first.
Shows how the gap and wrap properties work in a flex layout, plus a small trick to make the result look better.