CSS grid with auto-fit columns leaves a huge gap on the last row
Trying to do a card grid with grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)). With 5 cards and a wide screen I get 4 in the first row and 1 lonely card taking up a quarter of the second row, leaving a big empty gap. I want the last row cards to stretch. Grid newbie here. Is there a pure CSS way or do I need JS? Chrome 124.
3 replies