Earlier quoted context omitted.
JS masonry libraries, e.g. masonry.js, can and typically do use the HTML for the content and just lay it out similarly to what CSS does.
But the screen size is an important part of how the library will lay out the bricks, and that isn't known until JS runs (this can kind of be done with client hints, but not on initial page load)
Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
291–300 of 359 posts
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#292Reposting as a top comment for more visibility: I have a website with my photos, which doesn’t use any JS for layout. When I was making it, I considered using JS masonry libraries, but I wasn’t satisfied with the results. Proper masonry layouts which fill all available space in practice actually crop some images. Leaving space around photos is required when you don’t want cropping and want to preserve aspect ratio. T…
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#293So, the background story is that CSSWG DevRels from browser vendors are debating how to formally include the Masonry layout into CSS, at least since 2020, when Firefox first proposed it. The news here is that people at WebKit decided to push the debate to the public, inviting designers and developers to take some action (“post to social media, write blog posts”), in order to get past this. While it may look just like…
Part of the tension with building masonry on top of grid is that they work in fundamentally different ways. Grid you place everything in the grid first (e.g. an item goes in col:2,row:3), then size the grid. Masonry ideally you want to size the tracks first, then place items in those tracks. The first Firefox implementation (and the spec at that stage) basically said you don't consider any masonry items for sizing tr…
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#294Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#295Earlier quoted context omitted.
Yeah, I remember those. It was intended as a way to make "tables" using divs. That way, we could pretend to do page layout with CSS, while still feeling shitty about repurposing something meant for tables. There's just no justifiable reason for putting whole-page lay-out on the back-burner for so long. So many other far less important things came out before grid, it feels almost like it was deliberately spiteful to d…
Why would you feel shitty about using ‘display:table’? It puts things into a freaking grid as you asked for.
I was in the cult. It was totally inane, but seems to carry some effects to this day.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#296Earlier quoted context omitted.
Yeah, I remember those. It was intended as a way to make "tables" using divs. That way, we could pretend to do page layout with CSS, while still feeling shitty about repurposing something meant for tables. There's just no justifiable reason for putting whole-page lay-out on the back-burner for so long. So many other far less important things came out before grid, it feels almost like it was deliberately spiteful to d…
Why would you feel shitty about using ‘display:table’? It puts things into a freaking grid as you asked for.
Web-apps were "a thing" starting in the very early naughts, yet just getting stuff to stick where you wanted it on web page required a bunch of stupid hacks and accommodations. Of course people resorted to using tables for page layout. The display:table thing was just a continuation of that.
Whole-page layout should have been an absolute top priority for the folks that controlled css, yet it seems they just didn't care until grid finally came out in 2017-ish? I just don't understand why that is.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#297So, the background story is that CSSWG DevRels from browser vendors are debating how to formally include the Masonry layout into CSS, at least since 2020, when Firefox first proposed it. The news here is that people at WebKit decided to push the debate to the public, inviting designers and developers to take some action (“post to social media, write blog posts”), in order to get past this. While it may look just like…
> new proprieties I'm guessing this was going to be "properties"? It kinda looks like "proprietary" instead, so let's double down on that - I propose "display: tetris;"
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#298Earlier quoted context omitted.
I think one additional point to consider when adding it as a new display mode vs re-using grid, is that currently these demo's fallback quite nicely now when it's re-using grid. Instead of showing it as masonry (since my browser doesn't support it), it at least behaves as a grid. If it's a new display: X property, it will fallback to div behavior with the content all over the place in unsupported browsers.
you could simply do: "display: grid; display: masonry;" and all not-supporting browsers would skip the second declaration.
Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#299Re: Help us invent CSS Grid Level 3, a.k.a. "Masonry" layout
#300So, the background story is that CSSWG DevRels from browser vendors are debating how to formally include the Masonry layout into CSS, at least since 2020, when Firefox first proposed it. The news here is that people at WebKit decided to push the debate to the public, inviting designers and developers to take some action (“post to social media, write blog posts”), in order to get past this. While it may look just like…