Is there a CSS Grid configuration that will repeat (wrap) cells but dynamically shrink columns based on the size of the content, instead of using uniformly sized columns?
For example, here is a configuration using the following rules:
display: grid;
grid-template-columns: repeat(auto-fit, 186px);
grid-auto-columns: min-content;
notice that though the last column has narrower content, it uses the same width as the other columns (186px)
I'd like the columns to shrink to the width of the content, while still wrapping as screen size collapses.
notice the last column is now narrower that the others.
It seems grid-template-columns: repeat(); takes two arguments. The first of which can be auto-fit or auto-fill, but the second must be a specific width. Is there any way to allow this to be automatically computed based on content width?
Here is the codepen I've been playing with to try to achieve this.
Here is the real world scenario as well:
notice the first column should be wider to fill the content, and the second column should shrink to the content.
I'm familiar with flexbox, but I'm not super familiar with grid yet. Any guidance here would be much appreciated.