HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Set the direction of the flexible items inside the <div> element in reverse order
The flex-direction
property specifies the direction of the flexible items.
flex-direction
property has no effect.
Default value: | row |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.flexDirection="column-reverse" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -webkit- or -moz- specify the first version that worked with a prefix.
Property | |||||
---|---|---|---|---|---|
flex-direction | 29.0 21.0 -webkit- |
11.0 | 28.0 18.0 -moz- |
9.0 6.1 -webkit- |
17.0 |
Value | Description | Play it |
---|---|---|
row | Default value. The flexible items are displayed horizontally, as a row | Demo ❯ |
row-reverse | Same as row, but in reverse order | Demo ❯ |
column | The flexible items are displayed vertically, as a column | Demo ❯ |
column-reverse | Same as column, but in reverse order | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Using flex-direction
together with media queries to create a different layout for different screen sizes/devices:
.flex-container {
display: flex;
flex-direction: row;
}
/*
Responsive layout - makes a one column layout instead of a two-column layout
*/
@media (max-width: 800px) {
.flex-container {
flex-direction: column;
}
}
CSS Tutorial: CSS Flexible Box
CSS Reference: flex-flow property
CSS Reference: flex-wrap property
CSS Reference: flex property
CSS Reference: flex-grow property
CSS Reference: flex-shrink property
CSS Reference: flex-basis property
HTML DOM reference: flexDirection property