I use flexboxes to arrange the elements on my page.
I want flexboxes to use all available horizontal spaces, so I am adding flex-grow:1 .
Then I want each element on the same line to be the same size (e.g. 50% each if there are two elements, 33% if there are three, etc.), so I add flex-basis:0 .
But in the third stage, the elements are no longer transferred. If I change the width of the window, the number of elements in the line remains unchanged, and their contents are compressed. I do not want it. I want the element to be placed on the next line when their width becomes smaller than the content, since 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!
Jsfiddle
source share