CSS flex-wrapping eigenschap

Definition and usage

The flex-wrap property specifies whether the 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

Wrap flexible items as needed:

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

Try it yourself

CSS syntax

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

Attribute value

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

Technical details

Default value: nowrap
Inheritance: No
Animation creation: Not supported. See: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- 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