Live data from Hacker News

New layouts with CSS Subgrid

joshwcomeau.com

41–50 of 104 posts

Re: New layouts with CSS Subgrid

#42

Earlier quoted context omitted.

Yes and no. layouts were a hack that solved a real problem but came with massive downsides. People didn’t tell you to not use to lay out content because grids are bad (they are quite handy! take a look at Grid Systems by Josef Müller-Brockmann) but because both posed technical and accessibility problems. A layout grid is not a table (or a ). A table (with and without ) comes with attached semantics, hierarchy, readin…

> A layout grid is not a table Ain't it? Rows and columns get you a table.

A table is for tabulating data. They have quite different meaning and purpose, even if they share a couple of characteristics.

Re: New layouts with CSS Subgrid

#45
post #14

Have we wrapped all the way around to layouts again?

Yes and no. layouts were a hack that solved a real problem but came with massive downsides. People didn’t tell you to not use to lay out content because grids are bad (they are quite handy! take a look at Grid Systems by Josef Müller-Brockmann) but because both posed technical and accessibility problems. A layout grid is not a table (or a ). A table (with and without ) comes with attached semantics, hierarchy, readin…

Try to select a tr / td without pulling your hair.

Re: New layouts with CSS Subgrid

#46
post #43
post #9

is grid intended to replace flex at some point or live side by side

Live side by side unfortunately. I personally however always use grid, flexbox sucks.

Can you get the same alignment properties with the grid? If so, I will use the grid more often.

Re: New layouts with CSS Subgrid

#47
post #28

I never found it comfortable to work with grids. The syntax and layout just feel off. Flexbox is a much more flexible and easy thing to work with.

There's plenty of overlap, but they solve different problems: flexbox when the content should control element sizing/fit, grid when the container should control element sizing/fit.

But flex grow and align stretch exist, which moves control back to the parent...

A grid really feels like a list flexes to me too, functionally.

Re: New layouts with CSS Subgrid

#48

Random grid gotcha that drove me crazy some time ago: due to browser bugs we can't use elements with percentage widths or heights as grid items. The grid cell dimensions get blown out to the ones of the original image. Seen in both Firefox and Chromium. Relevant FF bug is probably https://bugzilla.mozilla.org/show_bug.cgi?id=1857365 ' grid item with percentage height, "width: auto", "grid-template-columns: auto", and…

so if the img has a specific size set in width and height attributes or via css, and that size is not percentile or auto, the problem doesn't exist?

I'm just confused by the "original image's width".

Post reply on HN