A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>.demo { grid-template-columns: repeat(12, 1fr); }</style><main class="demo">Example content</main>
Engineering judgment: The repeat(auto-fit, minmax()) pattern is powerful because it delegates many breakpoint decisions to the grid algorithm instead of hardcoding viewport thresholds.
<style>.demo { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }</style><main class="demo">Example content</main>
In production, auto-fit and auto-fill differ when there are fewer items than the available tracks. The distinction becomes visible as empty track space is collapsed or retained. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
The useful mental model here is practical: how fr, minmax, auto-fit, and auto-fill balance available space against intrinsic content. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Fractional Units and Responsive Grid Sizing | auto-fit and auto-fill differ when there are fewer items than the available tracks. The distinction becomes visible as empty track space is collapsed or retained. |
| 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, auto-fit and auto-fill differ when there are fewer items than the available tracks. The distinction becomes visible as empty track space is collapsed or retained. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
<style>.demo { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }</style><main class="demo">Example content</main>
Auto-fill scaffold is useful here because it demonstrates fractional units and responsive grid sizing under a concrete input rather than as an abstract property list.
<style>.demo { grid-template-columns: minmax(12rem, 20rem) 1fr; }</style><main class="demo">Example content</main>
Minmax bound is useful here because it demonstrates fractional units and responsive grid sizing 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.