Style flexDirectionProperty
Examples
Rearrange the direction of flexible items inside a <div> element:
document.getElementById("main").style.flexDirection="column-reverse";
Try it Yourself »
Definition and Usage
The flexDirection property sets or returns the direction of the flexible items.
Note:If the element is not a flexible item, the flexDirection property has no effect.
Browser Support
![]()
Firefox, Opera, and Chrome support the flexDirection property.
Syntax
Return the flexDirection property:
object.style.flexDirection
Set the flexDirection property:
object.style.flexDirection="row|row-reverse|column|column-reverse|initial|inherit"
Property Values
| Value | Description |
|---|---|
| row | Default value. The flexible items are displayed horizontally, as a row. |
| row-reverse | Same as row, but in reverse order. |
| column | The flexible items are displayed vertically, as a column. |
| column-reverse | Same as column, but in reverse order. |
| initial | Sets this property to its default value. Seeinitial。 |
| inherit | Inherits this property from its parent element. Seeinherit。 |
Technical Details
| Default value: | row |
|---|---|
| Return value: | A String, representing the element's flex-direction property. |
| CSS Version | CSS3 |
Related Articles
CSS Reference Manual:flex-direction property
HTML DOM STYLE Reference Manual:flex property
HTML DOM STYLE Reference Manual:flexBasis property
HTML DOM STYLE Reference Manual:flexFlow property
HTML DOM STYLE Reference Manual:flexGrow property
HTML DOM STYLE Reference Manual:flexShrink property
HTML DOM STYLE Reference Manual:flexWrap property
Other Extensions
Style Object