CSS flex-directionProperty

CSS Reference


Example

Set the direction of the flex items inside the <div> element to the opposite order:

div { display:flex; flex-direction:row-reverse; }

Try it Yourself »

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Numbers followed by -webkit-, -ms- or -moz- specify the first version that worked with the prefixed property.

Property
flex-direction 29.0
21.0 -webkit-
11.0
10.0 -ms-
28.0
18.0 -moz-
9.0
6.1 -webkit-
17.0

Definition and Usage

The flex-direction property specifies the direction of the flexible items.

Note:If the element is not a flex item, the flex-direction property has no effect.

Default value: row
Inherited: no
Animatable: No. SeeAnimatable。
version: CSS3
JavaScript Syntax: object.style.flexDirection="column-reverse" Try it Yourself


CSS Syntax

flex-direction: row|row-reverse|column|column-reverse|initial|inherit;

Property value

Value Description Example
row Default value. Flexible items will be displayed horizontally, as a row. Try it Yourself »
row-reverse Same as row, but in reverse order. Try it Yourself »
column Flexible items will be displayed vertically, as a column. Try it Yourself »
column-reverse Same as column, but in reverse order. Try it Yourself »
initial Sets this property to its default value. Seeinitial。 Try it Yourself »
inherit Inherits this property from the parent element. Seeinherit。  


Related Articles

CSS Reference:flex property

CSS Reference:flex-basis property

CSS Reference:flex-flow property

CSS Reference:flex-grow property

CSS Reference:flex-shrink property

CSS Reference:flex-wrap property


CSS Reference

other extensions