Style flexDirection Property
Example
Rearrange the direction of the flexible items inside the <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
Property | |||||
---|---|---|---|---|---|
flexDirection | Yes | 11.0 | Yes | 9.0 | Yes |
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. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | row |
---|---|
Return Value: | A String, representing the flex-direction property of an element |
CSS Version | CSS3 |
Related Pages
CSS reference: flex-direction property
HTML DOM STYLE Reference: flex property
HTML DOM STYLE Reference: flexBasis property
HTML DOM STYLE Reference: flexFlow property
HTML DOM STYLE Reference: flexGrow property
HTML DOM STYLE Reference: flexShrink property
HTML DOM STYLE Reference: flexWrap property
❮ Style Object