concept

Subgrid gap resolution — CSS reference

A subgrid’s normal gap uses the parent gap in that axis. An explicit different gap adjusts the child areas around shared line positions rather than creating an independent set of parent tracks. In the symmetric internal-gap example, reducing a 20px parent gap to zero extends each adjoining child area by 10px.

Formal Syntax & Structure

css syntaxcss
grid-template-columns: subgrid; column-gap: 0;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>subgrid-gap-resolution</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:100px 100px;column-gap:20px}#a{display:grid;grid-column:1 / 3;grid-template-columns:subgrid;column-gap:0}#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