flex-direction

  • Revision slug: CSS/flex-direction
  • Revision title: flex-direction
  • Revision id: 7450
  • Created:
  • Creator: FredB
  • Is current revision? No
  • Comment Creation of the flex-direction property page; page created, 255 words added

Revision Content

{{ CSSRef() }}

Summary

The flex-direction CSS property specifies how flexbox items are placed in the flexbox container defining the main-axis and the direction (normal or reversed). <style type="text/css"></style>

  • {{ Xref_cssinitial() }}: {{ Cssxref("row") }}
  • Applies to: flexboxes
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

 

Syntax

<style type="text/css"></style>
Formal grammar: <flex-direction>{1} 
                where <border-style> is row | row-reversed | column | column-reversed

flex-direction: row | row-reversed | column | column-reversed

Values

The following values are accepted:
row
fake
The flexbox's main-axis is defined to be the same as the text direction. The "main-start" and "main-end" points are the same
as the content direction.
row-reversed
fake
Behaves the same as row but the "main-start" and "main-end" points are permuted.
column
fake
The flexbox's main-axis is the same as he block-axis. The "main-start" and "main-end" points are the same as the "before"
and "after" points of the writing-mode.
column-reversed
fake
Behaves the same as column but the "main-start" and "main-end" are permuted.

Examples

element { 
  flex-direction: row-reversed;
}

Specifications

Specification Status Comment
CSS Flexible Box Layout Module {{ Spec2('CSS3 Flexbox') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Firefox Mobile (Gecko) Android IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

  • The border-related shorthand CSS properties: {{ Cssxref("border") }}, {{ Cssxref("border-width") }}, {{ Cssxref("border-color") }}, {{ Cssxref("border-radius") }}

{{ languages( {  } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2>Summary</h2>
<p>The <code>flex-direction</code> <a href="/en/CSS" title="CSS">CSS</a> property specifies how flexbox items are placed in the flexbox container defining the main-axis and the direction (normal or reversed). <nobr> &lt;style type="text/css"&gt;<!--[CDATA[.cssprop {
  display:table;
  padding: 0.4em;
  border-left:0.15em solid;
  background-color:#eeeeff
}
.cssprop li {
 display:table-row;
 padding: 3px;
 margin:0;
}
.cssprop li dfn {
  display:table-cell;
  padding: 0 5px;
  border-bottom: none;
  cursor:inherit;
}

	]]-->&lt;/style&gt; </nobr></p>
<ul class="cssprop"> <li><nobr><dfn>{{ Xref_cssinitial() }}:</dfn> {{ Cssxref("row") }}</nobr></li> <li><nobr><dfn>Applies to:</dfn> flexboxes</nobr></li> <li><nobr><dfn>{{ Xref_cssinherited() }}:</dfn> no</nobr></li> <li><nobr><dfn>Media:</dfn> {{ Xref_cssvisual() }}</nobr></li> <li><nobr><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</nobr></li>
</ul>
<p> </p>
<p><nobr></nobr></p><nobr>
<h2>Syntax</h2>
</nobr><div><nobr> &lt;style type="text/css"&gt;<!--[CDATA[pre.twopartsyntaxbox {
  border:1px solid #cccccc;
  border-bottom: none; 
  margin-bottom:0;
  background-color:#ffe;
  border-top-right-radius:1em;
  border-top-left-radius:1em;
}
pre.twopartsyntaxbox + pre {
  border:1px solid #cccccc;
  border-bottom-right-radius:1em;
  border-bottom-left-radius:1em;
  border-top:none;
  margin-top:0;
}
div.where {
  font-size: 0.9em;
}
div.where + p {
  float:left; 
  margin:0;
}
div.where dl {
  padding-left:6em;
}
div.where dt {
  float:left;width:7.5em
}
div.where dd {
  padding-left:7.5em
}

	
	
	]]-->&lt;/style&gt; </nobr><pre class="twopartsyntaxbox"><nobr></nobr><nobr>Formal grammar: &lt;flex-direction&gt;{1} 
                where &lt;border-style&gt; is row | row-reversed | column | column-reversed
</nobr>
</pre> <nobr> <pre>flex-direction: <em>row | row-reversed | column | column-reversed</em>
</pre> <h3>Values</h3> <dl> <dd>The following values are accepted: <table class="standard-table"> <tbody> <tr> <td style="vertical-align:middle;"><code>row</code></td> <td style="vertical-align:middle;"> <div style="margin:0.5em; width:3em; height:3em; border-style:none; background-color:palegreen;"><span style="display:none;">fake</span></div> </td> <td style="vertical-align:middle;">The flexbox's main-axis is defined to be the same as the text direction. The "main-start" and "main-end" points are the same<br> as the content direction.</td> </tr> <tr> <td style="vertical-align:middle;"><code>row-reversed</code></td> <td style="vertical-align:middle;"> <div style="margin:0.5em; width:3em; height:3em; border-style:hidden; background-color:palegreen;"><span style="display:none;">fake</span></div> </td> <td style="vertical-align:middle;">Behaves the same as <code>row</code> but the "main-start" and "main-end" points are permuted.</td> </tr> <tr> <td style="vertical-align:middle;"><code>column</code></td> <td style="vertical-align:middle;"> <div style="margin:0.5em; width:3em; height:3em; border-style:dotted; background-color:palegreen;"><span style="display:none;">fake</span></div> </td> <td style="vertical-align:middle;">The flexbox's main-axis is the same as he block-axis. The "main-start" and "main-end" points are the same as the "before"<br> and "after" points of the writing-mode.</td> </tr> <tr> <td style="vertical-align:middle;"><code>column-reversed</code></td> <td style="vertical-align:middle;"> <div style="margin:0.5em; width:3em; height:3em; border-style:dashed; background-color:palegreen;"><span style="display:none;">fake</span></div> </td> <td style="vertical-align:middle;">Behaves the same as <code>column</code> but the "main-start" and "main-end" are permuted.</td> </tr> </tbody> </table> </dd> </dl> <h2>Examples</h2> <pre>element { 
  flex-direction: row-reversed;
}
</pre> <h2 name="Specifications">Specifications</h2> <table class="standard-table"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td><a class="external" href="http://dev.w3.org/csswg/css3-flexbox/#flex-direction" title="http://dev.w3.org/csswg/css3-flexbox/#flex-direction">CSS Flexible Box Layout Module</a></td> <td>{{ Spec2('CSS3 Flexbox') }}</td> <td> </td> </tr> </tbody> </table> <h2>Browser compatibility</h2> <p>{{ CompatibilityTable() }}</p> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Firefox (Gecko)</th> <th>Chrome</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Firefox Mobile (Gecko)</th> <th>Android</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table> </div> <h2>See also</h2> <ul> <li>The border-related shorthand CSS properties: {{ Cssxref("border") }}, {{ Cssxref("border-width") }}, {{ Cssxref("border-color") }}, {{ Cssxref("border-radius") }}</li> </ul> <p>{{ languages( {  } ) }}</p> </nobr></div>
Revert to this revision