CSS Grid-Lanes (i.e. Masonry)
- Category
- CSS
- Type
- New or changed feature
- Status
- No active development (Chrome No active development)
- Intent stage
- None
WPT details: https://wpt.fyi/results/css/css-grid/grid-lanes
Summary
CSS Grid-Lanes is a layout module where items of varying heights are arranged in columns, filling gaps to create a seamless grid, similar to a brick wall, perfect for accommodating elements with varying aspect ratios. Unlike CSS Grid, Grid-Lanes is better suited for one-dimensional flow layouts, like image galleries, where the focus is on filling the space efficiently rather than aligning items along both axes. Grid-Lanes provides greater design freedom, enabling the creation of dynamic, responsive layouts that adapt to content variations without the need for manual adjustments or a non-standard JavaScript implementation.
Motivation
Without native support for Grid-Lanes, developers need to rely on non-standard implementations that might not be interoperable across browsers and require extra effort to maintain. In Blink, we want to specifically prototype the alternative approach of making CSS Grid-Lanes its own display type, looking to showcase that this approach is on par with developer's expectations without introducing unnecessary complexity to an already overloaded CSS Grid spec.
Standards & signals
- Specification: https://drafts.csswg.org/css-grid-3
- Firefox: Under consideration — Firefox has a partial prototype of CSS Grid-Lanes, but their implementation follows the principle of extending the Grid Module instead of implementing it as a separate display type.
- Safari: In development — Safari already supports https://drafts.csswg.org/css-grid-3/ at some capacity, but their implementation follows the principle of extending the Grid Module instead of implementing it as a separate display type.
- Web developers: Strongly positive — Developers are excited about native CSS Grid-Lanes support. Grid-Lanes (Masonry) Layout came out in third place in the "missing features" 2024 State of CSS survey question: https://2024.stateofcss.com/en-US/usage/#css_missing_features However, opinions are divided between whether the module should be an extension of the Grid Module or a display type on its own. Discussion around this issue can be found in the following CSSWG issues: https://github.com/w3c/csswg-drafts/issues/9041 https://github.com/w3c/csswg-drafts/issues/10233
- Tracking bug: https://issues.chromium.org/issues/343257585
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=css%2Fcss-grid%2Fgrid-lanes
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+CSS%20Grid-Lanes%20(i.e.%20Masonry)
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=CSS%20Grid-Lanes%20(i.e.%20Masonry)
- Baseline status: https://webstatus.dev/?q=CSS%20Grid-Lanes%20(i.e.%20Masonry)
Samples: https://microsoftedge.github.io/Demos/css-masonry
Explainers: https://developer.chrome.com/blog/masonry-update