CSS Layout: Flexbox & Grid
Layout stops being guesswork once you know which system owns which decision. We rebuild four common page shapes twice — once in Flexbox, once in Grid — so you can feel where each one is the honest choice.
The route
- 30 minWhich system owns which decision
Content-driven versus container-driven layout, and the one question that picks between them.
You board here - 30 minFlexbox properly
Main and cross axis, grow/shrink/basis, and why `margin-left: auto` solves so much.
- 30 minGrid properly
Tracks, minmax, auto-fit and named areas, and how to stop fighting implicit rows.
- 35 minFour page shapes, twice
Sidebar, holy grail, card row and media object — built in both, so you feel the difference.
A look at the teaching
Which system owns which decision.
/* Flexbox: the content decides. Items size themselves,
the container distributes what is left over. */
.toolbar { display: flex; gap: 8px; }
.toolbar .spacer { margin-left: auto; }
/* Grid: the container decides. The tracks exist whether
or not anything is in them. */
.page {
display: grid;
grid-template-columns: minmax(0, 1fr) 320px;
gap: 40px;
}
One rule covers most layout arguments: if the container should decide, reach for Grid. If the content should, reach for Flexbox.
Who is driving
Nóra teaches the way a good colleague explains things at a whiteboard — no jargon for its own sake, and nothing hidden behind “as you can see”.
Placeholder profile