A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>.row { flex-direction: row; }</style><main class="row">Example content</main>
The useful mental model here is practical: how flex direction chooses the main axis and why alignment terminology changes with direction. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
A good CSS change narrows the problem. Debug axis issues by writing the axes down before touching properties. Most “why did justify-content stop centering?” bugs are mental-model bugs, not syntax errors. This keeps the rule understandable when content, theme, or viewport conditions change later.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Main Axis and Cross Axis | justify-content always acts along the main axis, while align-items acts across it. Change flex-direction and their visual direction changes with the axis. |
| Production test | Real content and constraints | The rule works only for the demo values |
| Maintenance | Scope and override path | A later fix creates another exception |
In production, justify-content always acts along the main axis, while align-items acts across it. Change flex-direction and their visual direction changes with the axis. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
<style>.column { flex-direction: column; }</style><main class="column">Example content</main>
Engineering judgment: Debug axis issues by writing the axes down before touching properties. Most “why did justify-content stop centering?” bugs are mental-model bugs, not syntax errors.
<style>.row { align-items: center; }</style><main class="row">Example content</main>
Cross-axis alignment is useful here because it demonstrates main axis and cross axis under a concrete input rather than as an abstract property list.
<style>.stack { gap: 1rem; }</style><main class="stack">Example content</main>
Axis-aware gap is useful here because it demonstrates main axis and cross axis under a concrete input rather than as an abstract property list.
Finish the lesson once you have worked through the material. This awards ★ 30 XP.