align-items

  • Revision slug: CSS/align-items
  • Revision title: align-items
  • Revision id: 235119
  • Created:
  • Creator: scottrowe
  • Is current revision? No
  • Comment 19 words added, 69 words removed

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The align-items CSS property aligns flex items of the current flex line the same way as justify-content but in the perpendicular direction.

<style type="text/css"></style>
  • {{ Xref_cssinitial() }}: stretch
  • Applies to: flex containers
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

Formal grammar: <align-items> 
                where <align-items> is flex-start | flex-end | center | baseline | stretch
align-items: flex-start | flex-end | center | baseline | stretch

Values

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
CSS Flexible Box Layout Module {{ Spec2('CSS3 Flexbox') }}  

Browser compatibility

{{ page{path: "/en/CSS/Using_CSS_flexible_boxes", section: "Browser compatibility"} }}

See also

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h2>Summary</h2>
<p>The <code>align-items</code> <a href="/en/CSS" title="CSS">CSS</a> property aligns flex items of the current flex line the same way as <a href="/en/CSS/justify-content" title="en/CSS/justify-content"><code>justify-content</code></a> but in the perpendicular direction.</p>
<nobr>
<style type="text/css"><![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;
}





]]></style>
<ul class="cssprop"> <li><dfn>{{ Xref_cssinitial() }}:</dfn><code> stretch</code></li> <li><dfn>Applies to:</dfn> flex containers</li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li>
</ul>
</nobr>
<h2>Syntax</h2>
<pre class="twopartsyntaxbox">Formal grammar: &lt;align-items&gt; 
                where &lt;align-items&gt; is flex-start | flex-end | center | baseline | stretch
</pre>
<pre>align-items: flex-<em>start | flex-end | center | baseline | stretch</em>
</pre>
<h3>Values</h3>
<dl> <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>Examples</h2>
<pre> </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/#align-items" title="http://dev.w3.org/csswg/css3-flexbox/#align-items">CSS Flexible Box Layout Module</a></td> <td>{{ Spec2('CSS3 Flexbox') }}</td> <td> </td> </tr> </tbody>
</table>
<h2>Browser compatibility</h2>
<p>{{ page{path: "/en/CSS/Using_CSS_flexible_boxes", section: "Browser compatibility"} }}</p><h2>See also</h2>
<p><nobr></nobr></p>
Revert to this revision