-moz-box-pack

  • Revision slug: CSS/-moz-box-pack
  • Revision title: -moz-box-pack
  • Revision id: 312263
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

{{ warning("This is a property of the original CSS Flexible Box Layout Module standard which is being replaced by a new standard.") }}

See Flexbox for more information.

Summary

The CSS -moz-box-pack and -webkit-box-pack properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. The effect of this is only visible if there is extra space in the box. See Flexbox for more about the properties of flexbox elements.

The direction of layout depends on the element's orientation: horizontal or vertical.

  • {{ Xref_cssinitial() }} {{ Cssxref("start") }}
  • Applies to elements with a CSS {{ Cssxref("display") }} value of {{ Cssxref("-moz-box") }} or {{ Cssxref("-moz-inline-box") }} or {{ Cssxref("-webkit-box") }} or {{ Cssxref("-webkit-inline-box") }}
  • {{ Xref_cssinherited() }} no
  • Percentages n/a
  • Media {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }} as specified

Syntax

-moz-box-pack:    start | center | end | justify     /* Mozilla */
-webkit-box-pack: start | center | end | justify     /* WebKit */

Values

start
The box packs contents at the start, leaving any extra space at the end.
center
The box packs contents in the center, dividing any extra space equally between the start and the end.
end
The box packs contents at the end, leaving any extra space at the start.
justify
The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the pack value as if it were start.

Examples

<!DOCTYPE html>
<html>
  <head>
    <title>CSS box-pack example</title>
    <style>
      div.example {
        display: -moz-box;              /* Mozilla */
        display: -webkit-box;           /* WebKit */

        /* Make this box taller than the children, 
           so there is room for the box-pack */
        height: 400px;           
        
        /* Children should be oriented vertically */
        -moz-box-orient: vertical;      /* Mozilla */
        -webkit-box-orient: vertical;   /* WebKit */

        /* Align children to the horizontal center of this box */
        -moz-box-align: center;         /* Mozilla */
        -webkit-box-align: center;      /* WebKit */

        /* Pack children to the bottom of this box */
        -moz-box-pack: end;             /* Mozilla */
        -webkit-box-pack: end;          /* WebKit */
      }
      div.example > p {            
        /* Make children narrower than their parent, 
           so there is room for the box-align */ 
        width: 200px;
      }
    </style>
  </head>
  <body>
    <div class="example">
      <p>I will be second from the bottom of div.example, centered horizontally.</p>
      <p>I will be on the bottom of div.example, centered horizontally.</p>
    </div>
  </body>
</html>

Notes

The edge of the box designated the start for packing purposes depends on the box's orientation and direction:

  Normal Reverse
Horizontal left right
Vertical top bottom

The edge opposite to the start is designated the end.

If the packing is set using the element's pack attribute, then the style is ignored.

Specifications

This property is non-standard, though a similar property appeared an early draft of CSS3 flexbox that is over two years old and has since been superseded.

See also

{{ cssxref("box-orient") }}, {{ cssxref("box-direction") }}, {{ cssxref("box-align") }}

Revision Source

<div>{{ CSSRef() }}</div>
<p>{{ warning("This is a property of the original CSS Flexible Box Layout Module standard which is being replaced by a new standard.") }}</p>

<p>See <a href="/en-US/docs/CSS/Flexbox" title="CSS/Flexible_boxes">Flexbox</a> for more information.</p>

<h2 id="Summary" name="Summary">Summary</h2>

<p>The CSS <code>-moz-box-pack</code> and <code>-webkit-box-pack </code>properties specify how a <code>-moz-box</code> or <code>-webkit-box</code> packs its contents in the direction of its layout. The effect of this is only visible if there is extra space in the box. See <a href="/en-US/docs/CSS/Flexible_boxes#box-_implementation" title="CSS/Flexible_boxes#box-_implementation">Flexbox</a> for more about the properties of flexbox elements.</p>
<p>The direction of layout depends on the element's orientation: horizontal or vertical.</p>

<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}</dfn> {{ Cssxref("start") }}</li>
  <li><dfn>Applies to</dfn> elements with a CSS {{ Cssxref("display") }} value of {{ Cssxref("-moz-box") }} or {{ Cssxref("-moz-inline-box") }} or {{ Cssxref("-webkit-box") }} or {{ Cssxref("-webkit-inline-box") }}</li>
  <li><dfn>{{ Xref_cssinherited() }}</dfn> no</li>
  <li><dfn>Percentages</dfn> n/a</li>
  <li><dfn>Media</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}</dfn> as specified</li>
</ul>


<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="syntaxbox">
-moz-box-pack:    start | center | end | justify     /* Mozilla */
-webkit-box-pack: start | center | end | justify     /* WebKit */
</pre>

<h3 id="Values" name="Values">Values</h3>
<dl>
  <dt>
    <code>start</code></dt>
  <dd>
    The box packs contents at the start, leaving any extra space at the end.</dd>
  <dt>
    <code>center</code></dt>
  <dd>
    The box packs contents in the center, dividing any extra space equally between the start and the end.</dd>
  <dt>
    <code>end</code></dt>
  <dd>
    The box packs contents at the end, leaving any extra space at the start.</dd>
  <dt>
    <code>justify</code></dt>
  <dd>
    The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the pack value as if it were start.</dd>
</dl>

<h2 id="Examples" name="Examples">Examples</h2>
<pre class="brush: html">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;CSS box-pack example&lt;/title&gt;
    &lt;style&gt;
      div.example {
        display: -moz-box;              /* Mozilla */
        display: -webkit-box;           /* WebKit */

        /* Make this box taller than the children, 
           so there is room for the box-pack */
        height: 400px;           
        
        /* Children should be oriented vertically */
        -moz-box-orient: vertical;      /* Mozilla */
        -webkit-box-orient: vertical;   /* WebKit */

        /* Align children to the horizontal center of this box */
        -moz-box-align: center;         /* Mozilla */
        -webkit-box-align: center;      /* WebKit */

        /* Pack children to the bottom of this box */
        -moz-box-pack: end;             /* Mozilla */
        -webkit-box-pack: end;          /* WebKit */
      }
      div.example &gt; p {            
        /* Make children narrower than their parent, 
           so there is room for the box-align */ 
        width: 200px;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class="example"&gt;
      &lt;p&gt;I will be second from the bottom of div.example, centered horizontally.&lt;/p&gt;
      &lt;p&gt;I will be on the bottom of div.example, centered horizontally.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="Notes" name="Notes">Notes</h2>
<p>The edge of the box designated the <em>start</em> for packing purposes depends on the box's orientation and direction:</p>
<table cellspacing="8" class="standard-table" style="text-align:center;">
  <tbody>
    <tr>
      <th>&nbsp;</th>
      <th><strong>Normal</strong></th>
      <th><strong>Reverse</strong></th>
    </tr>
    <tr>
      <th style="text-align:right;"><strong>Horizontal</strong></th>
      <td>left</td>
      <td>right</td>
    </tr>
    <tr>
      <th style="text-align:right;"><strong>Vertical</strong></th>
      <td>top</td>
      <td>bottom</td>
    </tr>
  </tbody>
</table>

<p>The edge opposite to the start is designated the <em>end</em>.</p>
<p>If the packing is set using the element's <code>pack</code> attribute, then the style is ignored.</p>

<h2 id="Specifications" name="Specifications">Specifications</h2>

<p>This property is non-standard, though a similar property appeared<a class="external" href="http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/"> an early draft of CSS3 flexbox</a> that is over two years old and has since been superseded.</p>

<h2 id="See_Also" name="See_Also">See also</h2>
<p>{{ cssxref("box-orient") }}, {{ cssxref("box-direction") }}, {{ cssxref("box-align") }}</p>
Revert to this revision