79821553

Date: 2025-11-16 15:37:09
Score: 1.5
Natty:
Report link

I think my expectations were a bit unusual. I wanted a grid, which auto sizes every column to minimum its own content size (min-content/auto) and afterwards distributed the remaining space in each track between every column in every track.

repeat(auto-fit, minmax(auto, 1fr)

Grid does not seem to support different column sizes across grid tracks. Which kind of makes sense, but I first expected that to be possible.

I thought grid could look at the maximum content size of its items, to know the largest column. Then use that as an automatic value for minimum in minmax. Layout all the columns, then distribute remaining space with 1fr max. Is there a reason something like this is not possible?

repeat(auto-fit, minmax(max-content, 1fr)

The alternative is then using flexbox, using row direction, wrap and cross axis alignment of start or something like that. I guess that is perfectly valid.

But I thought 2D: I should use grid. However in this case flexbox fits, as mdn suggests, since I want to layout from "content out".

grid vs flexbox: grid page

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Clockworks