property

grid-auto-flow — CSS reference

Controls the direction and packing of automatic placement. Initial row; not inherited. Row flow scans columns before creating rows; column flow scans rows before creating columns. Dense packing can fill earlier holes, changing visual order without changing DOM order.

Formal Syntax & Structure

css syntaxcss
[ row | column ] || dense

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>grid-auto-flow</title><style>body{margin:0}#g{display:grid;grid-template-rows:30px 30px;grid-auto-flow:column;grid-auto-columns:80px;}#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 id="b">B</div><div id="c">C</div></div></body></html>
CSS Reference