flex-wrap property

Specifies whether flex items wrap and the direction they wrap onto multiple lines or columns based on the space available in the flex container.

This property is read/write.

Syntax

flex-wrap: nowrap | wrap | wrap-reverse

Property values

One of the following values.

nowrap

Initial value. All flex items are displayed in a single row or column. The overflow property of the flex container determines whether the flex items are hidden, clipped, or scrollable.

wrap

Flex items are wrapped and displayed in successive, parallel rows or columns. The flex container expands in height or width, perpendicular to the axis defined by the writing-mode property, to accommodate the additional rows or columns.

wrap-reverse

Flex items are wrapped and displayed in successive, parallel rows or columns in reverse order. The flex container expands in height or width, perpendicular to the axis defined by the writing-mode property, to accommodate the additional rows or columns.

In the example below, flex-wrap is set to wrap. When the flex container is resized, the flex items are wrapped and displayed in successive, parallel rows. The flex container expands in height perpendicular to the axis defined by the writing-mode property, to accommodate the additional rows or columns.

In this example, flex-wrap is set to wrap-reverse. When the flex container is resized, the flex items are wrapped and displayed in successive, parallel rows in reverse order. The flex container expands in height, perpendicular to the axis defined by the writing-mode property, to accommodate the additional rows.