What is the CSS flex-direction property?
The flex-direction property in
There is no effect of this property on non-flexible items.
Syntax
flex-direction: row|row-reverse|column|column-reverse|initial|inherit;
Property values
-
row: It is the default value. It is used to display the flex items in a row. The items are displayed horizontally. -
row-reverse: It is used to display the items in a row but in reverse order. -
column: It is used to display the flex items in a column. The items are displayed vertically. -
column-reverse: It is used to display the items in a column but in reverse order. -
initial: It sets the value to its default value. -
inherit: It inherits the property from its parent value.
Code
The basic flex-direction property is as follows:
In this example, we can see that we have made 3 boxes and set the flex-direction to row-reverse in line 8. We can see that all the boxes appear in the reverse direction in the output. We can set the flex-direction of our choice.