Default Behavior (flex: 0 1 auto)
Short
Medium content
Much longer content that takes up more space
Master flex-grow
, flex-shrink
, and
flex-basis
to control how flex items behave when space changes. These properties are
essential for responsive layouts.
flex-grow
- How much an item should growflex-shrink
- How much an item should shrinkflex-basis
- The initial size before growing/shrinkingflex: 1
- Equal distribution (flex: 1 1 0)flex: 0 0 auto
- Fixed size, no growing/shrinkingflex: 0 1 auto
- Default behaviorflex-grow
for proportional layouts and responsive designflex-shrink: 0
prevents items from getting smaller than their basis