concept

Masonry layout — CSS reference

Grid lanes, also called masonry, packs items along parallel lanes without requiring shared row tracks in the stacking axis. Current Grid Level 3 draft uses grid-lanes rather than older masonry proposals. Use normal grid as a fallback and preserve meaningful DOM order; a multi-column layout is not an equivalent algorithm. The fixture measures the ordinary grid fallback and detects the proposed syntax.

Formal Syntax & Structure

css syntaxcss
display: grid; @supports (display: grid-lanes) { .gallery { display: grid-lanes; } }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>masonry-layout</title><style>body{margin:8px;font:16px/1.5 sans-serif}*{box-sizing:border-box}#a{display:grid;grid-template-columns:repeat(2,1fr);width:280px;gap:8px}@supports(display:grid-lanes){#a{display:grid-lanes}}#b{height:80px}#c{height:140px}</style><body><div id="a"><article id="b">Short</article><article id="c">Tall</article><article>Third</article></div></body></html>
CSS Reference