Any absolute CSS wizards able to tell me why, in order to actually shrink when the window shrinks, a grid cell element needs min-width: 0?
Sincerely, man who just lost an hour of his life to this.
Sincerely, man who just lost an hour of his life to this.
Comments
The actual spec because it's not always this way, just sometimes this way.
https://www.w3.org/TR/css-grid-1/#min-size-auto
I would love to believe it's one of life's mystery and that's just how things are
https://x.com/adamwathan/status/1734696245015494711
https://bsky.app/profile/samwho.dev/post/3ldk36tt74s2k
If it made sense we would be to easy to replace.
If there isn’t any space, the element will take its minimum width based on its content.
(The same behavior applies to flex.)
minmax(0, 1fr) minmax(0, 1fr)
Think of it like this:
1. **First**: Calculate the minimum width of each cell.
2. **Then**: The `1fr 1fr` determines how you divide the remaining extra space between the cells.