CSS flex-wrap attribute

Definition and Usage

The flex-wrap property specifies whether flexible items should wrap.

Note:The flex property is invalid if the element is not a flexible item.

See also:

CSS Tutorial: CSS Flexible Box

CSS Reference Manual:flex Property

CSS Reference Manual:flex-basis 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

HTML DOM Reference Manual:flexWrap Property

Example

Make flexible items wrap when needed:

div {
  display: flex;   
  flex-wrap: wrap;
}

Try it yourself

CSS Syntax

flex-wrap: nowrap|wrap|wrap-reverse|initial|inherit;

Property Value

Value Description
nowrap Default Value. Specifies that flexible items should not wrap.
wrap Specifies that flexible items should wrap when needed.
wrap-reverse Specifies that flexible items should wrap in the reverse direction when needed.
initial Sets this property to its default value. See also initial.
inherit Inherits this property from its parent element. See also inherit.

Technical Details

Default Value: nowrap
Inheritance: No
Animation Production: Not supported. See also:Animation-related properties.
Version: CSS3
JavaScript Syntax: object.style.flexWrap="nowrap"

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

Numbers with -webkit- or -moz- prefixes indicate the first version using the prefix.

Chrome IE / Edge Firefox Safari Opera
29.0
21.0 -webkit-
11.0 28.0
18.0 -moz-
9.0
6.1 -webkit-
17.0