CSS subgrid: share parent tracks with a nested grid
Answer: With subgrid, track sizing, templates and names can be shared with nested grids. A nested grid can inherit track sizing, line names, and gap from its parent grid. Set grid-template-columns to subgrid to use the parent's columns.
Why subgrid exists
CSS grid is a very powerful layout engine.
This feature is now available in all three major browser engines. It became Baseline Newly available as of September 15, 2023.
Tracks created on a parent grid can only position direct children of the grid container.
With subgrid, track sizing, templates and names can be shared with nested grids.
Author defined named grid areas and lines were lost on any element that was not a direct child.
Inheriting tracks from the parent
Any grid item can also become its own grid container by adding display set to grid.
To use the parent's grid columns on a nested grid, set grid-template-columns to subgrid.
By default, this nested grid has its own track sizing, separate from the parent grid.
With subgrid, a child grid container will inherit track sizing, line names, and gap from the parent.
To use the parent's grid rows, set grid-template-rows to subgrid. Shared grid lines then make it easier to align items.
See also
Claims
- id: C1 claim: Subgrid can share track sizing, templates, and names with nested grids. source: S1 evidence: "track sizing, templates and names can be shared with nested grids"
- id: C2 claim: Parent tracks can only position direct children of the grid container. source: S1 evidence: "only be used to position direct children of the grid container"
- id: C3 claim: A child grid can inherit track sizing, line names, and gap from the parent. source: S2 evidence: "inherit the track sizing, line names, and gap from the parent grid"
- id: C4 claim: Set grid-template-columns to subgrid to use the parent's columns. source: S2 evidence: "grid-template-columns: subgrid"
Sources
- [S1] CSS subgrid. web.dev. https://web.dev/articles/css-subgrid . License: CC-BY-4.0. Accessed 2026-11-23.
- [S2] CSS Grid. web.dev. https://web.dev/learn/css/grid . License: CC-BY-4.0. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, CSS subgrid; web.dev, CSS Grid. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: web.dev, CSS subgrid; web.dev, CSS Grid. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0.
Cite this
iinventedlight. 2026. "CSS subgrid: share parent tracks with a nested grid." iinventedlight Library, iil:note:rmgb08dh, version of 2026-11-23. https://iinventedlight.com/library/notes/css-subgrid/. License: CC-BY-4.0.
@misc{iil_note_rmgb08dh,
author = {{iinventedlight}},
title = {{CSS subgrid: share parent tracks with a nested grid}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/css-subgrid/},
note = {Permanent ID iil:note:rmgb08dh. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- css-subgrid.schema.json (schema; CC-BY-4.0)
- css-subgrid.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/css-subgrid.md.