mozilla

Revision 4504 of justify-content

  • Revision slug: CSS/justify-content
  • Revision title: justify-content
  • Revision id: 4504
  • Created:
  • Creator: FredB
  • Is current revision? No
  • Comment Creation of the flex-pack property page; page created, 323 words added

Revision Content

{{ CSSRef() }}

Summary

The flex-pack CSS property aligns flexbox items in the main-axis of the current line. The alignment is done after the lengths and auto margins are applied.

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

Syntax

Formal grammar: <flex-pack> 
                where <flex-pack> is start | end | center | justify | distribute

flex-flow: start | end | center | justify | distribute

Values

start
The flexbox items are packed starting from the main-start. Margins of the first flexbox item is flushed with the main-start edge of the line and each following flexbox item is flushed with the preceding.
end
The flexbox items are packed starting from the main-end. The margin edge of the last flexbox item is flushed with the main-end edge of the line and each preceding flexbox item is flushed with the following.
center
The flexbox items are packed toward the center of the line. The flexbox items are flushed with each other and aligned in the center of the line. Space between the main-start edge of the line and first item and between main-end and the last item of the line is the same.
justify
Flexbox items are evenly distributed along the line. The spacing is done such as the space between two adjacent items is the same. Main-start edge and main-end edge are flushed with respectively first and last flexbox item edges.
distribute
Flexbox items are evenly distributed so that the space between two adjacent items is the same. The empty space before the first and after the last items equals half of the space between two adjacent items.

Examples

 

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

Revision Source

<p>{{ CSSRef() }}</p>
<h2>Summary</h2>
<p>The <code>flex-pack</code> <a href="/en/CSS" title="CSS">CSS</a> property aligns flexbox items in the main-axis of the current line. The alignment is done after the lengths and auto margins are applied.<nobr> </nobr></p>
<ul class="cssprop"><nobr> <li><dfn>{{ Xref_cssinitial() }}:</dfn> start</li> <li><dfn>Applies to:</dfn> flexboxes</li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li> </nobr>
</ul>
<nobr> </nobr>
<h2>Syntax</h2>
<pre class="twopartsyntaxbox"><nobr>Formal grammar: &lt;flex-pack&gt; 
                where &lt;flex-pack&gt; is start | end | center | justify | distribute
</nobr>
</pre>
<nobr> </nobr>
<pre><nobr>flex-flow: <em>start | end | center | justify | distribute</em>
</nobr>
</pre>
<h3>Values</h3>
<dl> <dt><code>start</code></dt> <dd>The flexbox items are packed starting from the main-start. Margins of the first flexbox item is flushed with the main-start edge of the line and each following flexbox item is flushed with the preceding.</dd> <dt><code>end</code></dt> <dd>The flexbox items are packed starting from the main-end. The margin edge of the last flexbox item is flushed with the main-end edge of the line and each preceding flexbox item is flushed with the following.</dd> <dd> </dd><dt><code>center</code></dt> <dd>The flexbox items are packed toward the center of the line. The flexbox items are flushed with each other and aligned in the center of the line. Space between the main-start edge of the line and first item and between main-end and the last item of the line is the same.</dd> <dt><code>justify</code></dt> <dd>Flexbox items are evenly distributed along the line. The spacing is done such as the space between two adjacent items is the same. Main-start edge and main-end edge are flushed with respectively first and last flexbox item edges.</dd> <dt><code>distribute</code></dt> <dd>Flexbox items are evenly distributed so that the space between two adjacent items is the same. The empty space before the first and after the last items equals half of the space between two adjacent items.</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/#flex-flow" title="http://dev.w3.org/csswg/css3-flexbox/#flex-flow">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>
<p><nobr></nobr></p>
Revert to this revision