Style flexWrap attribute

Definition and usage

flexWrap This attribute specifies whether the flexible items should wrap.

Note:If the element is not a flexible item, then flexWrap Invalid attribute.

See also:

CSS Reference Manual:flex-wrap attribute

Example

Make the flexible items wrap if necessary:

document.getElementById("main").style.flexWrap = "wrap";

Try it yourself

Syntax

Return flexWrap attribute:

object.style.flexWrap

Set flexWrap attribute:

object.style.flexWrap = "nowrap|wrap|wrap-reverse|initial|inherit"

Attribute value

Value Description
nowrap Default value. Specifies that the flexible items will not wrap.
wrap Specifies that the flexible items should wrap when necessary.
wrap-reverse Specifies that the flexible item should wrap in reverse order when necessary.
initial Set this attribute to its default value. See initial.
inherit This attribute inherits this property from its parent element. See inherit.

Technical details

Default value: nowrap
Return value: A string that represents the element's flex-wrap attribute.
CSS version: CSS3

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 11.0 Support 9.0 Support

Related pages

HTML DOM STYLE Reference: flex attribute

HTML DOM STYLE Reference: flexBasis attribute

HTML DOM STYLE Reference: flexDirection attribute

HTML DOM STYLE Reference: flexFlow attribute

HTML DOM STYLE Reference: flexGrow attribute

HTML DOM STYLE Reference: flexShrink attribute