CSS3 flex-direction
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The flex-direction
CSS property specifies how flex items are placed in the flex container, by setting the direction of the flex container's main axis.
The following table summarizes the usages context and the version history of this property.
Default value: | row |
---|---|
Applies to: | Flex containers |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the flex-direction
property in action.
Example
Try this code ».flex-container {
/* Safari */
display: -webkit-flex;
-webkit-flex-direction: row-reverse;
/* Standard syntax */
display: flex;
flex-direction: row-reverse;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
row |
The flex container's main-axis has the same orientation as the inline axis of the current writing mode i.e. text direction. |
row-reverse |
Same as row, but the start and end points of the axis are reversed. |
column |
The flex container's main axis to be the same orientation as the block axis (the vertical axis in horizontal writing modes and the horizontal axis in vertical writing modes) of the current text direction. |
column-reverse |
Same as column, but the start and end points of the axis are reversed. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element flex-direction property. |
Browser Compatibility
The flex-direction
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Multi-column Layouts.
Related properties: align-content
, align-items
, align-self
, display
, flex
, flex-basis
, flex-flow
, flex-grow
, flex-shrink
, flex-wrap
, justify-content
, min-height
, min-width
, order
.