Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style flexDirection Property

Style flexDirection Property

Style Object Reference The Style object

Example

Rearranging

The direction of flexible items within an element:

document.getElementById("main").style.flexDirection="column-reverse";

Try it »


Definition and Usage

The flexDirection property sets or returns the direction of the flexible items.

**Note:** The flexDirection property has no effect if the element is not a flexible item.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

Firefox, Opera and Chrome support the flexDirection property.


Syntax

Returns the flexDirection property:

object

.style.flexDirection

Sets the flexDirection property:

object

.style.flexDirection="row|row-reverse|column|column-reverse|initial|inherit"

Attribute values

Value Description
row Default value. The flexible items are displayed horizontally, as a row.
row-reverse Same as row, but in the reverse order.
column The flexible items are displayed vertically, as a column.
column-reverse Same as column, but in the reverse order.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: row
Return Value: A string that represents the flex-direction property of an element.
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


Style Object Reference The Style object