HTML & CSS · Middle · Question 4 of 75
How does flex-basis differ from width on a flex item in a row (flex-direction: row)?
- 1No difference:
flex-basisis a synonym forwidth, the browser just takes the last one - 2
widthalways beatsflex-basisand overrides it when both are set on an item - ✓Correct answer:
flex-basisis the initial main-axis size; if it isn'tauto, it takes precedence overwidth
Explanation
flex-basis sets the item's initial size along the main axis, from which grow and shrink are computed. With flex-basis: auto, width is used (or height in a column). With flex-direction: column, flex-basis applies to height rather than width - that's the key difference from width.