Why would you use flex-wrap CSS property and what values can it have?
Experience Level: Junior
Tags: CSSFlexbox
Answer
The flex-wrap
property affects how the flex container items will be wrapped.
It can have the following values:
nowrap
- this makes all the flex items stay on the one row (for row direction) or column (for column direction)wrap
- this makes all the flex items that don't fit on one row (for row direction) or column (for column direction) wrap to another row/column.wrap-reverse
- this has the same value aswrap
, except the items wrap to the other side.
div {
display: flex;
flex-wrap: nowrap;
}
Related Flexbox job interview questions
What is a cross axis in Flexbox?
CSSFlexbox JuniorHow would you use space-between and what do you know about it?
CSSFlexbox JuniorWhen would you use flex-flow property and what is it good for?
CSSFlexbox JuniorHow does flex-flow property work and what are its advantages?
CSSFlexbox JuniorHow can you explicitly reorder items in a flexbox container?
CSSFlexbox Junior