Top
Best
New

Posted by frizlab 12/19/2025

CSS Grid Lanes(webkit.org)
754 points | 229 commentspage 2
memonkey 12/19/2025|
Masonry grid layout was one of a few interviewing pair programming tests I would give to frontend engineers. I need to see how this works under the hood!
interstice 12/20/2025||
Kinda odd they didn't call it masonry given it's already been called that forever. At least grid-lanes is reasonably self explanatory.
pbowyer 12/20/2025||
I'm pleased they rename it because grid-lanes opens up more than masonry layouts.

I've been waiting to be able to have a fully responsive layout (where interleave sidebar content in with the page content on small screens, but have it in a sidebar on larger screens) without using any JavaScript, and this finally makes it possible.

Demo: https://codepen.io/pbowyer/pen/raLBVaV

Previous comment: https://news.ycombinator.com/item?id=46228993

qingcharles 12/20/2025||
The naming was half the discussion on implementing this. There were a lot of people smarter and more knowledgeable than me that had a lot of opinions on the name that I hadn't thought about. I remember one of the reasons was that the word "masonry" wasn't as obvious a concept for non-English speakers.
ricksunny 12/20/2025||
I wonder how long it takes LLMs to correctly ingest fresh CSS notation like this.
todotask2 12/20/2025||
I think Apple should make Safari stable downloadable option for all platforms.
speedgoose 12/20/2025||
I’m old enough to have installed Safari on Windows XP. I’m not sure it has been enough years since this Apple failed product.
kuekacang 12/20/2025||
experiencing how text renders differently, slowly, with my potato battleship
alwillis 12/20/2025|||
There are WebKit-based browsers for Linux: https://webkit.org/downloads/
jacobp100 12/20/2025||
This might actually happen indirectly. Kagi’s new browser uses WebKit. macOS only now, but eventually it’ll come to windows
todotask2 12/21/2025||
I have been using Kagi Orion on macOS and iPhone, so far so good.
jeroenhd 12/20/2025||
I have to ask, like with all the other browser specific trial implementations: how is cross platform support? If we wanted to make a grid layout that only worked in one browser engine, grid-template-rows: masonry was there for a while now.

Chromium still seems to be working on support it seems based on https://cr-status.appspot.com/feature/5149560434589696 so maybe it'll be useful soon? That page indicates that they're still discussing certain parts of the spec.

qingcharles 12/20/2025|
It's been on-and-off in all three browsers behind flags etc, but it's been in a constant state of flux over the last three years. One of the most gnarly new CSS features to get right. Lots of great arguments about how to implement it.
oefrha 12/20/2025||
I've been using Chromium's display: masonry in some internal apps since they introduced it behind a flag in Chromium 140. Looks like they just have to rename it now?
qingcharles 12/20/2025|
I have too. And the Safari version that was in the betas/tech previews.

One of the biggest arguments over the last couple of years was what to call it. A lot, lot of ideas put forth as alternatives to "masonry" which wasn't thought to be great for non-English speakers. I'm glad they finally nailed a name for it!

The other big argument was over how to activate it. Is it a grid? Is it a flexbox? Is it a brand new animal?

Now I just need to figure out the best way to implement this semantically with a polyfill for the next 30 months until it's baseline.

oefrha 12/20/2025||
I actually started using Safari's `grid-template-rows: masonry` when it came out, but unfortunately Safari TP crashed a lot on me when using that for some reason. Chromium's never had a problem.
swyx 12/20/2025||
how does it work with animations? like if i transition:all and then remove a middle img does the other elements get animated?
qingcharles 12/20/2025|
I guess wire up a codepen demo and try it out. I know the guys writing this were well aware of all the edge cases like that and these are some of the absolute smartest CSS people you can think of who had to write the very detailed spec for this.

I don't think the smooth reflow made it into the current spec, so I guess watch this space?

https://www.w3.org/TR/css-grid-3/

imbnwa 12/20/2025||
What’s the best resource for getting a handle on all modern CSS for someone who hasn’t paid attention since flex box
satvikpendem 12/20/2025||
I like Josh W Comeau's content, he has a lot of free articles, but his paid CSS course goes through step by step why CSS is the way that it is, worked great for me for understanding it all. My work paid for it though, that's why it's priced so high, but I'm sure he has discounts for individuals.
alwillis 12/20/2025|||
This should be a good start: https://nerdy.dev/cascading-secret-sauce
perardi 12/20/2025||
There are a lot of resources.

I am a fan of: https://www.youtube.com/@KevinPowell

Kevin is a no-nonsense no-hype educator. He will keep you up to date without a lot of engagement hacking.

nitwit005 12/19/2025||
How would you query the location where you need to load more data when scrolling down (the highest empty spot)?
tom1337 12/20/2025||
I guess you can just start loading a first batch, add an intersection observer to the last 3 elements (if you have 3 lanes) and then when one of those intersects you simply start fetching the next.
notpushkin 12/20/2025||
Hmm, I think we only need to observe the `elements.at(-numberOfLanes)`, as it should be the first to enter the screen anyway.
rokkamokka 12/20/2025|||
I suppose just checking scroll height of the container? Once you're x pixels above the bottom, fetch more. Not the smoothest, but doable
jonah 12/20/2025||
You just append new <figure> elements to the <main> in the example and it will automatically put them in the appropriate column.
nitwit005 12/20/2025||
Your answer doesn't appear to relate to what I asked. You need to know when to query the backend for more data if it's an infinite scrolling setup.
jonah 12/20/2025||
Aahh. The way you phrased your question was pretty ambiguous.

The other posters have good answers. One thing to consider for a smooth interaction would be to eagerly load the next x elements before they scroll into view.

pcl 12/20/2025||
Yeah I’d assume you’d eagerly load enough to make sure everything gets at least partially into the viewport, and maybe a fee more to optimize for network latency. And then perhaps track elements whose trailing ends are not in the viewport, and load more once those become fully visible?
temporallobe 12/20/2025|
It’s always nice to see native implementations of functionality pioneered by third-party libraries. Bootstrap, for example, has made this kind layout (somewhat) possible but there is also a Masonry plugin that simplifies it.
More comments...