CSS flex-direction property
Example
Settings
Set the direction of the flexbox elements inside the element to the reverse order:
div
{
display:
flex
;
flex-direction:
row-reverse
;
}
Try it »
Browser support
The numbers in the table indicate the version number of the first browser that supports this property.
The number immediately following -webkit-, -ms-, or -moz- is the first version that supports 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 flexbox object, the flex-direction property has no effect.
| Default value: | row |
|---|---|
| Inherited: | No |
| Animatable: | No. See Animatable. |
| Version: | CSS3 |
| JavaScript syntax: | object.style.flexDirection="column-reverse" Try it |
CSS Syntax
flex-direction: row|row-reverse|column|column-reverse|initial|inherit;
Attribute values
| Value | Description | Example |
|---|---|---|
| row | Default value. The flexible items are displayed horizontally, as a row. | Try it » |
| row-reverse | Same as row, but in the reverse order. | Try it » |
| column | The flexible items are displayed vertically, as a column. | Try it » |
| column-reverse | Same as column, but in the reverse order. | Try it » |
| initial | Sets this property to its default value. See initial. | Try it » |
| inherit | Inherits this property from its parent element. See inherit. |
Related Articles
CSS Reference Manual:flex Property
CSS Reference Manual:flex-basis Property
CSS Reference Manual:flex-flow Property
CSS Reference Manual:flex-grow Property
CSS Reference Manual:flex-shrink Property
CSS Reference Manual:flex-wrap Property
CSS Reference Manual