Hacker News new | ask | show | jobs
by dimal 1178 days ago
Grid isn't a good solution for this particular problem because the layout depends on the intrinsic size of the content. Grid is good for when you want the container to define the layout and have the content flow into it. Flex is good for when you want the layout to adapt to the content, like in this case.
1 comments

Flex is good when you need flexing. A single row grid, with variable width cells is simpler.

See elsewhere in the thread where I solved this and / or submit a fork your own version using flex.

Here's a fork.

https://codepen.io/mrdanimal/pen/VwGNOQw?editors=0100

As far as I could tell there was no visual change. It's not drastically different, but once you make everything flex, it's possible to remove a few of the grid properties.

(Off topic: can you please remove my name from your fork? Thanks)
Sure. I’m AFK but I’ll get it in a little while.