Mechanical ComparisonCSS Grid Track Sizing Algorithm: Baseline · WidelyCSS Subgrid: Baseline · Newly

CSS Grid Track Sizing Algorithm vs CSS Subgrid

Mechanical Verdict

Independent nested grids size their own tracks, whereas subgrid inherits track definitions from the parent grid.

Try CSS Grid Track Sizing Algorithm LabTry CSS Subgrid LabRead CSS Grid Track Sizing Algorithm DissectionRead CSS Subgrid Dissection

Structured Comparison Matrix

DimensionCSS Grid Track Sizing AlgorithmCSS Subgrid
Mental ModelGrid resolves tracks in four passes: fixed lengths, intrinsic content bounds, minmax() clamping, and fr free-space distribution.subgrid lets nested grid containers inherit parent row or column tracks so sibling cards align internal headers and footers.
Maturity & DomainBaseline · Widely · CSS & Layout
Chrome 57+ · Firefox 52+ · Safari 10.1+
Baseline · Newly · CSS & Layout
Chrome 117+ · Firefox 71+ · Safari 16+
Prerequisites
When Not to UseWhen not to use Grid: Avoid Grid for simple inline wrapping chips or toolbars where items should size to their own content and wrap naturally, use Flexbox with flex-wrap: wrap.When not to use subgrid: Avoid subgrid when cards have variable numbers of internal sections, use Flexbox margin-top: auto on the footer instead.

Engine Mechanics & Trade-Offs

CSS Grid Track Sizing AlgorithmBaseline · Widely

1fr is shorthand for minmax(auto, 1fr); intrinsic minimum sizing runs before fr space division, causing grid blowout unless minmax(0, 1fr) is used.

Key Pitfalls: The 1fr grid blowout: Writing 1fr instead of minmax(0, 1fr) allows unbreakable text or <pre> blocks to push the track wider than the viewport. auto-fill vs auto-fit confusion: auto-fill preserves empty ghost tracks at the end of a row; auto-fit collapses empty tracks to 0px so existing items expand.

CSS SubgridBaseline · Newly

Items inside a subgrid contribute their intrinsic sizes directly to the parent grid’s track-sizing pass.

Key Pitfalls: Forgetting grid-row: span N: A card defaults to spanning 1 row; without span N, all 3 subgrid children collide inside that single row. Inherited gap: Subgrids inherit the parent's gap automatically; override row-gap or column-gap on the subgrid if internal spacing should be tighter.