CSS Tools
Advertisement
Google AdSense Placement Area
Responsive Ad Unit
Back to All Tools/Modern CSS/CSS Subgrid Layout Tester
CSS Grid Level 2

CSS Subgrid Layout Tester

.parent-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
}

.card-subgrid {
  grid-column: span 3;
  display: grid;
  grid-template-columns: subgrid;
}

Nested Cards Aligned to Parent Track (grid-template-columns: subgrid)

Track 1 Header
Body tracks aligned across columns
Track 2 Header
Body tracks aligned across columns
Track 3 Header
Body tracks aligned across columns
Advertisement
Google AdSense Placement Area
Responsive Ad Unit

Dimensional Inheritance: The Subgrid Architecture

Solving the cross-component alignment problem in CSS Grid Level 2.

Since the inception of CSS Grid (Level 1), developers faced a glaring architectural limitation: nested grids were completely blind to the track sizing of their parents. If you created a horizontal row of "Card" components where each card had an internal layout (Header, Body, Footer), there was no native way to align the internal Headers across all cards horizontally. If one card had a longer title, its header grew, instantly misaligning it with sibling cards.

The grid-template-columns: subgrid (and rows) specification resolves this by allowing deep DOM nodes to opt into their ancestor's dimensional tracks. When a child container declares itself a subgrid, it halts the creation of its own independent layout tracks. Instead, it "punches through" the DOM hierarchy to attach its own children directly to the sizing calculations of the master parent grid.

This establishes true multidimensional alignment. You can now define a macro-level application grid, and have deeply nested micro-components align perfectly to those macro tracks without resorting to hacky fixed heights, JavaScript resize observers, or accessibility-damaging display: contents workarounds.

Browser Matrix: CSS Grid Level 2

Native engine support for the subgrid keyword

Rendering EngineSupportThreshold
Blink (Chrome/Edge)Fullv117+ (Sep 2023)
WebKit (Safari)Fullv16+
Gecko (Firefox)Fullv71+ (Pioneer)

Grid Architecture FAQ

Advertisement
Google AdSense Placement Area
Responsive Ad Unit