Subgrid
Subgrid is a CSS Grid feature that lets a nested grid use and align with its parent grid's tracks for rows, columns, or both.
CSS in Depth, Second Edition
Subgrid is a CSS Grid feature that lets a nested grid use the grid lines of its parent grid for its rows, columns, or both.
- How it is used
- Aligns deeply nested card content across shared parent rows when ordinary parent-child layout cannot preserve consistent positions.
- How deep it goes
- Explains the alignment principle, builds an author-card layout, demonstrates named lines, and notes browser support without detailing rendering internals.
- Examples
- Uses three author cards whose headings, paragraphs, and Read More links align across shared rows.
- What you can do after
- Build it from scratch by nesting grids, spanning parent tracks, inheriting them with subgrid, and placing items on inherited or named lines.
Vanilla Web
Subgrid is a CSS Grid feature that lets a nested grid participate in the track sizing and alignment of its parent grid.
- How it is used
- Aligns nested grids across component boundaries without duplicating parent track definitions.
- How deep it goes
- Defines shared tracks, names both axis properties, and gives use cases, but stops short of a worked subgrid stylesheet.
- Examples
- Uses aligned card headers, bodies, and actions plus shared sidebar and main-content boundaries as use cases.
- What you can do after
- Apply it via `grid-template-columns: subgrid` or `grid-template-rows: subgrid` to align nested layouts with ancestor tracks.
Also covered in
What to know first
- flexboxFlexbox is a CSS one-dimensional layout model for arranging, sizing, aligning, and distributing items along a row or column.
Related concepts
- grid lineuses · A grid line is a horizontal or vertical boundary in a CSS Grid layout that defines track edges and item placement positions.
- griduses · A grid is a regular arrangement of positions or cells organized by rows and columns or by fixed neighboring relationships.
- grid areauses · A grid area is a rectangular region of one or more CSS Grid cells, optionally identified by a name for layout placement.
- grid-template-columnsconfigured by · The CSS grid-template-columns property defines the sizes and optional names of a grid’s column tracks and grid lines.
- grid-template-rowsconfigured by · The CSS grid-template-rows property defines the number, sizes, and track structure of a grid's rows.
Questions about subgrid
What is subgrid?
Subgrid is a CSS Grid feature that lets a nested grid use and align with its parent grid's tracks for rows, columns, or both.
Which Manning books explain subgrid?
CSS in Depth, Second Edition and Vanilla Web.
What should I know before learning subgrid?
Manning books that teach subgrid usually introduce flexbox first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

