Breaking: CSS Grid Lanes Revolutionizes Web Layout
The long-awaited masonry layout feature has finally arrived, bringing native support for waterfall-style layouts without JavaScript.
A polyfill for the new display: grid-lanes CSS feature, enabling masonry-style layouts in all browsers.
The classic masonry layout with auto-fill columns. Items flow into whichever column gets them closest to the top.
.gallery {
display: grid-lanes;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 16px;
}
Alternating narrow and wide columns using complex repeat patterns.
.varying-cols {
display: grid-lanes;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr) minmax(180px, 2fr)) minmax(120px, 1fr);
gap: 12px;
}
Using grid-column: span N to create hero and featured articles.
.newspaper {
display: grid-lanes;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 24px;
}
.article.hero { grid-column: span 3; }
.article.featured { grid-column: span 2; }
The long-awaited masonry layout feature has finally arrived, bringing native support for waterfall-style layouts without JavaScript.
How Grid Lanes changes everything we know about fluid layouts.
Benchmarks show significant improvements over JavaScript solutions.
Get started in minutes.
Current implementation status across browsers.
Moving from JS masonry libraries to native CSS.
Ensuring your masonry layouts work for everyone.
Complex layouts with explicit placement.
Using negative indices to place items in specific columns (the "Special" item is placed in the last column).
.placed {
display: grid-lanes;
grid-template-columns: repeat(5, 1fr);
gap: 16px;
}
.special { grid-column: -2 / -1; }
Define rows instead of columns to create horizontal masonry flow.
.brick {
display: grid-lanes;
grid-template-rows: repeat(3, 100px);
gap: 12px;
}
Perfect for navigation footers with variable-length link groups.
.mega-menu {
display: grid-lanes;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 32px 24px;
}