CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS3 flex-direction Property

Topic: CSS3 Properties Reference« Prev|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:

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

The example below shows the flex-direction property in action.

  • .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.

Browsers Icon

Basic Support—

  • Firefox 18+ -moz-, 28
  • Google Chrome 21+ -webkit-, 29
  • Internet Explorer 10+ -ms-, 11
  • Apple Safari 6.1+ -webkit-
  • Opera 12.1+

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.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.