concept

Grid track sizing algorithm — CSS reference

After placement, resolve column and row constraints, with a limited repeat when cross-axis contributions change. For each axis initialize base sizes and limits, accommodate intrinsic contributions (including spans), grow nonflexible sizes using available space, resolve flexible fractions, then stretch eligible auto tracks. Alignment occurs after sizing. This fixture isolates a definite-size case; the full algorithm also handles indefinite space and subgrids.

Formal Syntax & Structure

css syntaxcss
grid-template-columns: minmax(80px, 120px) 1fr;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>grid-track-sizing-algorithm</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:minmax(80px,120px) 1fr}</style><body><div id="g"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference