Picture problem
My client of course wants to list vehicles on his website in a responsive manner. But all known techniques (flex, grid) wrap the last item to the next row.
What I try to do with pictures
But for a hero, this is extremely ugly. Customer wants:
The tricky part is that the number of items must be dynamic. Usually between 4 and 6 cars
I know I can choose the last two items like this
.item:nth-last-child(-n+2) { order: 2; /* set order to 2 for the last two items */ }
But I can't force them to wrap. Any ideas?
It turns out that I have to get the number of items in advance and inject the class into the list to control the display
...