What is the use of Flex?
Correspondingly, what is the use of display flex?
A flex container expands items to fill available free space or shrinks them to prevent overflow. Most importantly, the flexbox layout is direction-agnostic as opposed to the regular layouts (block which is vertically-based and inline which is horizontally-based).
Then, what Flex 1 means?
We all know, the flex property is a shorthand for the flex-grow , flex-shrink , and the flex-basis properties. And its default value is 0 1 auto . It means: flex-grow: 0; flex-shrink: 1; flex-basis: auto; but I've noticed, in many places flex: 1 is used.
Flex-shrink is the opposite of flex-grow, determining how much a square is allowed to shrink. It only comes into play if the elements must shrink to fit into their container — i.e. when the container is just too small. Its main use is to specify which items you want to shrink, and which items you don't.