← All notes

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

Sources

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

Permanent ID: iil:note:rmgb08dh

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.},
}

Markdown

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.

All artifact files (JSON index)

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.