align-self

  • Revision slug: Web/CSS/align-self
  • Revision title: align-self
  • Revision id: 474107
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef("CSS Flexible Boxes") }}

Summary

The align-self CSS property aligns flex items of the current flex line overriding the align-items value. If any of the flex item's cross-axis margin is set to auto, then align-self is ignored.

{{cssbox("align-self")}}

See Using CSS flexible boxes for more properties and information.

Syntax

Formal syntax: {{csssyntax("align-self")}}
align-self: auto
align-self: flex-start
align-self: flex-end
align-self: center
align-self: baseline
align-self: stretch

align-self: inherit

Values

auto
Computes to parent's {{cssxref("align-items") }} value or stretch if the element has no parent.
flex-start
The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.
flex-end
The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.
center
The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.
baseline
All flex items are aligned such that their baselines align. The item with the largest distance between its cross-start margin edge and its baseline is flushed with the cross-start edge of the line.
stretch
Flex items are stretched such as the cross-size of the item's margin box is the same as the line while respecting width and height constraints.

Examples

 

Specifications

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

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 21.0{{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("18.0") }} (behind a pref) [1]
{{ CompatGeckoDesktop("20.0") }}
{{ 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. To activate flexbox support, for Firefox 18 and 19, the user has to change the about:config preference "layout.css.flexbox.enabled" to true.

See also

Revision Source

<p>{{ CSSRef("CSS Flexible Boxes") }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>align-self</code> <a href="/en-US/docs/CSS" title="CSS">CSS</a> property aligns flex items of the current flex line overriding the <a href="/en/CSS/align-items" title="en/CSS/flex-align"><code>align-items</code></a> value. If any of the flex item's cross-axis margin is set to <code>auto</code>, then <code>align-self</code> is ignored.</p>
<p>{{cssbox("align-self")}}</p>
<p>See&nbsp;<a href="/en/CSS/Using_CSS_flexible_boxes" title="/en/CSS/Using_CSS_flexible_boxes">Using CSS flexible boxes</a>&nbsp;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-self")}}</pre>
<pre>
align-self: auto
align-self: flex-start
align-self: flex-end
align-self: center
align-self: baseline
align-self: stretch

align-self: inherit
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>auto</code></dt>
  <dd>
    Computes to parent's {{cssxref("align-items") }} value or <code>stretch</code> if the element has no parent.</dd>
  <dt>
    <code>flex-start</code></dt>
  <dd>
    The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.</dd>
  <dt>
    <code>flex-end</code></dt>
  <dd>
    The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.</dd>
  <dt>
    <code>center</code></dt>
  <dd>
    The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.</dd>
  <dt>
    <code>baseline</code></dt>
  <dd>
    All flex items are aligned such that their baselines align. The item with the largest distance between its cross-start margin edge and its baseline is flushed with the cross-start edge of the line.</dd>
  <dt>
    <code>stretch</code></dt>
  <dd>
    Flex items are stretched such as the cross-size of the item's margin box is the same as the line while respecting width and height constraints.</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-self', 'align-self') }}</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>{{ CompatGeckoDesktop("18.0") }} (behind a pref) [1]<br />
          {{ CompatGeckoDesktop("20.0") }}</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. To activate flexbox support, for Firefox 18 and 19, the user has to change the about:config preference "layout.css.flexbox.enabled" to <code>true</code>.</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