I have a card grid with: repeat(auto-fit, minmax(300px, 1fr)) as template columns. This works fine, unless there’s less than than the number of item that can fit in the column.
so for instance, when I filter posts and only have 1 result, the card of the 1 result takes up the whole width of the grid. I don’t wan that, I wan it to respond like it would with multiple results.
Not sure what you mean, but my plan was to have the grid automatically adjust with the minmax. But this obv does not work with the situation I ran into.
So my main content container width is 1160. The minmax set the minimum value to 300, this would mean 1fr 1fr 1fr on desktop — and lower screen width adjust to the 300px value. I would like w 1 result on desktop to have the card only take 1 “slot” of the 3.
I understand, i never use fractions so i just read that they are normally defined by (3, 1fr); where 3 is the total number of fractions and 1 is the number used.
Also, if the minimum is 300, but there’s no other content, css might claim the full width as it has no other fraction to decide its width.
maybe defining the total number does something: repeat(auto-fit, minmax(300px, 3, 1fr))