b2KIT

CSS Subgrid Playground

Experiment with CSS subgrid to align nested grid items with parent tracks using visual controls.

Tested tool guide Tested browser tools Checked August 16, 2026

What CSS Subgrid Playground does and how it behaves

CSS Subgrid Playground makes the relationship between parent and nested tracks visible. Its controls let you vary the parent grid, the nested grid's span, and the axis that uses subgrid, then observe whether inner items share the parent's track boundaries. The important surprise is that subgrid is axis-specific. Using grid-template-columns: subgrid adopts the relevant parent columns but does not adopt its rows. Also, a nested grid spanning only part of its parent receives only that portion of the parent's track structure.

How the result is produced

1

Inherited track boundaries

When a nested grid uses subgrid on an axis, it does not define an independent track list on that axis. Its tracks correspond to the parent tracks covered by the nested grid item's placement and span. This shared geometry is what lets content in separate nested containers align to common parent column or row boundaries.

2

Independent axes

Columns and rows can use subgrid independently. A container may inherit parent columns while defining its own rows, inherit parent rows while defining its own columns, or use subgrid on both axes. Changing how many parent tracks the container spans changes the inherited track range available for placing its children.

Good uses

  • Check whether labels, values, and actions inside several card components can align to the same parent columns despite different content lengths.
  • Explore a form layout where field groups are nested containers but their labels and controls must follow page-level column tracks.
  • Compare an independently sized nested grid with a column or row subgrid before choosing the structure for a component layout.

Limits and checks

  • Confirm which axis uses subgrid. Matching columns do not imply that nested row boundaries also come from the parent.
  • Check the nested grid item's parent placement and span. Children cannot use inherited tracks outside the portion of the parent occupied by that item.
  • Treat the preview as evidence for the browser currently rendering it, not as proof that every target browser supports the same subgrid declarations.

Common questions

Does subgrid copy every track from the parent grid?

No. It uses the parent tracks only on the axis declared as subgrid and only across the area spanned by the nested grid item. A child covering three parent columns receives that corresponding three-track range, not unrelated columns elsewhere in the parent. The other axis remains independent unless it also uses subgrid.

Can columns use subgrid while rows keep their own sizing?

Yes. Set grid-template-columns to subgrid and define the row tracks normally on the nested grid. The reverse arrangement is also valid: rows can follow the parent while columns remain independently defined. This distinction is useful when only one direction needs alignment across neighboring nested components.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools