I am wondering whether it makes sense to keep adding more "layout" options to CSS, given that we have the legacy floats and then the modern flexbox and grid layout. If there are still cases that are not covered, perhaps a better solution to to have one final constraints-based system that covers all layout cases, even if it comes at the cost of complexity. The CSS frameworks and utility libraries will then be built on…
Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
11–20 of 359 posts
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#12I am wondering whether it makes sense to keep adding more "layout" options to CSS, given that we have the legacy floats and then the modern flexbox and grid layout. If there are still cases that are not covered, perhaps a better solution to to have one final constraints-based system that covers all layout cases, even if it comes at the cost of complexity. The CSS frameworks and utility libraries will then be built on…
I’m not sure a constraint based system would do much good as it would sit awkwardly in the middle of grid and JS.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#13If one wants to do a "Masonry" layout, what's wrong with calculating it via JavaScript?
But yes, more powerful "client side" layouting functionality would be very welcome so we wouldn't have to wait the commitees for a decade to center an element etc. And there is the "Houndini" project to get this going, but the browser support is still extremely poor: https://houdini.glitch.me/
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#14I am wondering whether it makes sense to keep adding more "layout" options to CSS, given that we have the legacy floats and then the modern flexbox and grid layout. If there are still cases that are not covered, perhaps a better solution to to have one final constraints-based system that covers all layout cases, even if it comes at the cost of complexity. The CSS frameworks and utility libraries will then be built on…
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#15The reading order you’d expect: https://temp.chrismorgan.info/2024-04-23-masonry-megamenu-2.....
What the demo actually gives you: https://temp.chrismorgan.info/2024-04-23-masonry-megamenu-1..... This affects correct reading order and tab indexes. Basically, sighted users will always read things in the “wrong” order. This just drives home that there is no structure, it’s just an unstructured bag of links. Except… actually if you go through them in numbered order, it looks like there was some fairly logical ordering. It’s just been utterly demolished by inappropriate masonisation.
(I’ve turned on “number items” in those screenshots. Normally, it’d look more like normal columns with no backgrounds.)
The way it should be implemented is with columns, but adding `break-inside: avoid` on each section, which their demo has missed.
The newspaper demo is also a little dubious for similar reasons, but it’s a much smaller deal.
Now images and such media which are in more independent blocks and where reading order isn’t such an ingrained thing, masonry layout does work better there. There are still patches where things can be a bit iffy, mostly around tab indexing, but it’s not obviously wrong any more.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#16If one wants to do a "Masonry" layout, what's wrong with calculating it via JavaScript?
Because why introduce a custom abstraction to implement something with an imperative scripting language when you can achieve the same result with a declarative language built specifically to address this use case? You'd rather maintain all the maths and JS dependencies for this than have browsers just render what you want?
But maybe it’s just a few dozen more properties and mini-DSLs away this time! Pay no attention to those sirens and false prophets who still believe in anti-CSS “tell the computer how to do exactly what you want” programming…
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#17I find it amusing that they've decided to refer to this as masonry layout. If you actually built a wall like this (as opposed to uniformly-sized rows, without any columns) it would be a structural engineering disaster.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#18I am wondering whether it makes sense to keep adding more "layout" options to CSS, given that we have the legacy floats and then the modern flexbox and grid layout. If there are still cases that are not covered, perhaps a better solution to to have one final constraints-based system that covers all layout cases, even if it comes at the cost of complexity. The CSS frameworks and utility libraries will then be built on…
The whole point of this initiative is to stop using out of date float-hacks, or soon-to-be out of date hacks to CSS grid or flexbox. Firefox's masonry layout is in fact implemented in such a way that basically covers all layout cases by simply adding a new attribute that collapses grid rows.
That's good to know.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#19If one wants to do a "Masonry" layout, what's wrong with calculating it via JavaScript?
I’d rather have browser vendors responsible for a correct implementation. This seems like a rather nuanced feature.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#20Earlier quoted context omitted.
Because why introduce a custom abstraction to implement something with an imperative scripting language when you can achieve the same result with a declarative language built specifically to address this use case? You'd rather maintain all the maths and JS dependencies for this than have browsers just render what you want?
It’s been nearly 30 years now that we’ve heard this refrain about CSS. Somehow the dream of “just tell the browser to render what I want” still remains elusive. But maybe it’s just a few dozen more properties and mini-DSLs away this time! Pay no attention to those sirens and false prophets who still believe in anti-CSS “tell the computer how to do exactly what you want” programming…