align-content

  • Revision slug: CSS/align-content
  • Revision title: align-content
  • Revision id: 336673
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The CSS align-content property aligns a flex container's lines within the flex container when there is extra space on the cross-axis. This property has no effect on single line flexible boxes.

  • {{ Xref_cssinitial() }} {{cssinitial("align-content")}}
  • Applies to multi-line flex containers
  • {{ Xref_cssinherited() }} no
  • Media {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }} {{ Xref_cssspecifiedkeyword() }}
  • {{ Xref_cssanimatable() }} {{ Xref_cssnotanimatable() }}
  • {{ Xref_csscanonicalorder() }} {{ Xref_cssuniqueorder() }}

See Using CSS flexible boxes for more properties and information.

Syntax

Formal syntax: {{csssyntax("align-content")}}
align-content: flex-start
align-content: flex-end
align-content: center
align-content: space-between
align-content: space-around
align-content: stretch

align-content: inherit

Values

flex-start
Lines are packed starting from the cross-start. Cross-start edge of the first line and cross-start edge of the flex container are flushed together. Each following line is flush with the preceding.
flex-end
Lines are packed starting from the cross-end. Cross-end of the last line and cross-end of the flex container are flushed together. Each preceding line is flushed with the following line.
center
Lines are packed toward the center of the flex container. The lines are flushed with each other and aligned in the center of the flex container. Space between the cross-start edge of the flex container and first line and between cross-end of the flex container and the last line is the same.
space-between
Lines are evenly distributed in the flex container. The spacing is done such as the space between two adjacent items is the same. Cross-start edge and cross-end edge of the flex container are flushed with respectively first and last line edges.
space-around
Lines are evenly distributed so that the space between two adjacent lines is the same. The empty space before the first and after the last lines equals half of the space between two adjacent lines.
stretch
Lines stretch to use the remaining space. The free-space is split equally between all the lines.

Examples

 

Specifications

Specification Status Comment
{{ SpecName('CSS3 Flexbox', '#align-content', 'align-content') }} {{ Spec2('CSS3 Flexbox') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 21.0{{ property_prefix("-webkit") }} {{ CompatNo() }} [1] {{ CompatNo() }} 12.10 {{ CompatNo() }}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatNo() }} 12.10 {{ CompatNo() }}

[1] Firefox supports only single-line flexbox.

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <a href="/en-US/docs/CSS" title="CSS">CSS</a> <code>align-content</code> property aligns a flex container's lines within the flex container when there is extra space on the cross-axis. This property has no effect on single line flexible boxes.</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}</dfn> {{cssinitial("align-content")}}</li>
  <li><dfn>Applies to</dfn> multi-line flex containers</li>
  <li><dfn>{{ Xref_cssinherited() }}</dfn> no</li>
  <li><dfn>Media</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}</dfn> {{ Xref_cssspecifiedkeyword() }}</li>
  <li><dfn>{{ Xref_cssanimatable() }}</dfn> {{ Xref_cssnotanimatable() }}</li>
  <li><dfn>{{ Xref_csscanonicalorder() }}</dfn> {{ Xref_cssuniqueorder() }}</li>
</ul>
<p>See <a href="/en/CSS/Using_CSS_flexible_boxes" title="/en/CSS/Using_CSS_flexible_boxes">Using CSS flexible boxes</a> for more properties and information.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="/en-US/docs/CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("align-content")}}
</pre>
<pre>
align-content: flex-start
align-content: flex-end
align-content: center
align-content: space-between
align-content: space-around
align-content: stretch

align-content: inherit
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>flex-start</code></dt>
  <dd>
    Lines are packed starting from the cross-start. Cross-start edge of the first line and cross-start edge of the flex container are flushed together. Each following line is flush with the preceding.</dd>
  <dt>
    <code>flex-end</code></dt>
  <dd>
    Lines are packed starting from the cross-end. Cross-end of the last line and cross-end of the flex container are flushed together. Each preceding line is flushed with the following line.</dd>
  <dt>
    <code>center</code></dt>
  <dd>
    Lines are packed toward the center of the flex container. The lines are flushed with each other and aligned in the center of the flex container. Space between the cross-start edge of the flex container and first line and between cross-end of the flex container and the last line is the same.</dd>
  <dt>
    <code>space-between</code></dt>
  <dd>
    Lines are evenly distributed in the flex container. The spacing is done such as the space between two adjacent items is the same. Cross-start edge and cross-end edge of the flex container are flushed with respectively first and last line edges.</dd>
  <dt>
    <code>space-around</code></dt>
  <dd>
    Lines are evenly distributed so that the space between two adjacent lines is the same. The empty space before the first and after the last lines equals half of the space between two adjacent lines.</dd>
  <dt>
    <code>stretch</code></dt>
  <dd>
    Lines stretch to use the remaining space. The free-space is split equally between all the lines.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<pre>
&nbsp;</pre>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Flexbox', '#align-content', 'align-content') }}</td>
      <td>{{ Spec2('CSS3 Flexbox') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>21.0{{ property_prefix("-webkit") }}</td>
        <td>{{ CompatNo() }} [1]</td>
        <td>{{ CompatNo() }}</td>
        <td>12.10</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Chrome for Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</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>{{ CompatNo() }}</td>
        <td>12.10</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<p>[1] Firefox supports only single-line flexbox.</p>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/CSS/Using_CSS_flexible_boxes" title="/en-US/docs/CSS/Using_CSS_flexible_boxes">Using CSS flexible boxes</a></li>
  <li>{{ CSS_Reference:FlexBox() }}</li>
</ul>
Revert to this revision