Flex item properties control how each child grows, shrinks, and occupies base space inside container constraints.
Item controls
flex-grow,flex-shrink,flex-basis- Shorthand
flex align-selffor per-item cross-axis override
Debug this snippet
.sidebar { flex: 1; }\n.main { flex: 1; }
If you need fixed sidebar width, use .sidebar { flex: 0 0 16rem; } and let main flex.
Important interview questions and answers
- Q: What does
flex: 1imply?
A: Item can grow and shrink with a zero-ish basis depending on shorthand expansion. - Q: Why set
min-width: 0on flex children?
A: Allows content to shrink instead of forcing overflow. - Q: When use align-self?
A: Override one item’s cross-axis alignment inside shared container rules.
Tip: Set display:flex on the parent; align/justify control children along axes.