keyword
auto-fit — CSS reference
Uses the same automatic repetition count as auto-fill, then collapses empty repeated tracks and their adjacent gutters after placement. Remaining flexible tracks can expand.
Formal Syntax & Structure
css syntaxcss
repeat(auto-fit, minmax(100px, 1fr))Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>auto-fit</title><style>body{margin:0}#g{display:grid;width:300px;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));}#g>*{background:#146e73;color:white;box-sizing:border-box}#b{background:#345d8e}#c{background:#79518e}</style><body><div id="g"><div id="a">A</div></div></body></html>