I use flexboxes to organize elements on my page.
I want the flexboxes to use all available horizontal space, so I add flex-grow:1
.
Then I want each item on the same line to be of the same size (e.g. 50% each if there is two items, 33% if there is three, etc), so I add flex-basis:0
.
But at the third step, the items don't wrap anymore. If I change the window width, the number of items per line stays always the same, and their content is squeezed. I don't want that. I want an item to be put on the next line when their width become smaller than it's content, as it works in the first two steps. I tried playing with flex-shrink
and other things, without success.
What can I do ? Thanks !
Answer TL;DR: Adding min-width: fit-content
works !