CSS flex-wrap property
Example
Wrap the flexbox elements when necessary:
display
:flex
; flex-wrap:
wrap
;
Try it »
Browser support
The numbers in the table indicate the version number of the first browser that supports this property.
The number immediately following -webkit-, -ms-, or -moz- is the first version that supports the prefixed property.
| property | |||||
|---|---|---|---|---|---|
| flex-wrap | 29.0 | ||||
| 21.0 -webkit- | 11.0 | ||||
| 10.0 -ms- | 28.0 | ||||
| 18.0 -moz- | 9.0 | ||||
| 6.1 -webkit- | 17.0 |
Definition and Usage
The flex-wrap property specifies whether the flex container is single-line or multi-line, and the direction of the cross axis determines the direction in which new lines are stacked.
**Note:** If the element is not a flexbox object, the flex-wrap property has no effect.
| Default value: | nowrap |
|---|---|
| Inherited: | No |
| Animatable: | No. See Animatable. |
| Version: | CSS3 |
| JavaScript syntax: | object.style.flexWrap="nowrap" Try it |
CSS Syntax
flex-wrap: nowrap|wrap|wrap-reverse|initial|inherit;
Attribute values
| Value | Description |
|---|---|
| nowrap | Default value. Specifies that the flexible items will not wrap. |
| wrap | Specifies that the flexible items will wrap onto multiple lines or columns when necessary. |
| wrap-reverse | Specifies that the flexible items will wrap when necessary, but in reverse order. |
| initial | Sets this property to its default value. See initial. |
| inherit | Inherits this property from its parent element. See inherit. |
Related Articles
CSS Reference Manual:flex Property
CSS Reference Manual:flex-direction Property
CSS Reference Manual:flex-flow Property
CSS Reference Manual:flex-grow Property
CSS Reference Manual:flex-shrink Property
CSS Reference Manual:flex-basis Property
CSS Reference Manual