Menu

1 / 5

CSS Grid Lanes: native masonry, now in Safari

DEV Community: css·richi.codes·about 13 hours ago
#pDJRbsCN
#devtocss#devto#dev#grid#lanes
Reading 0:00
15s threshold

This note has an interactive demo. Try it in the original

Masonry layouts, the Pinterest-style wall of cards with different heights, finally have a native CSS value: display: grid-lanes . Safari ships it, and Safari 27.2 (WebKit's release post is from October 26) just renamed the one property that controls how it behaves. Chrome and Firefox aren't there yet, so this is a good moment to learn how it works and how to use it today without breaking anything.

What it is and why it matters

For years, a masonry wall meant a JavaScript library measuring every card and positioning it absolutely. CSS Grid alone can't do it: rows force every card in a row to share the same height, so short cards leave holes under them. Multi-column layout packs things tightly, but it fills the first column top to bottom before moving to the next, so items 1, 2 and 3 end up stacked on the left instead of reading across.

Grid Lanes, defined in CSS Grid Layout Level 3, sits in between.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.