concept

Subgrid axis independence — CSS reference

Subgrid is selected per axis. In a subgridded axis the available tracks are bounded by the parent span, with no ordinary implicit track growth there. The independent axis can create implicit tracks and have its own dimensions.

Formal Syntax & Structure

css syntaxcss
grid-template-columns: subgrid; grid-auto-rows: 25px;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>subgrid-axis-independence</title><style>body{margin:0}#g{display:grid;width:300px;grid-template-columns:100px 1fr;grid-auto-rows:40px;justify-content:start;align-content:start;background:#e8edf1}#g>*{background:#126f70;color:white}#b{background:#325d8c}#g{grid-template-columns:70px 110px;gap:10px;grid-auto-rows:auto}#a{display:grid;grid-column:1 / 3;grid-template-columns:subgrid;grid-auto-rows:25px;row-gap:0}#y{grid-row:2;grid-column:2}#b{display:none}</style><body><div id="g"><div id="a"><div id="x">X</div><div id="y">Y</div></div><div id="b">B</div></div></body></html>
CSS Reference