On 2015-05-26 at 09:00 PST, MDN search will be unavailable for 5-10 minutes for system maintenance.

mozilla

Revision 7475 of flex-basis

  • Revision slug: CSS/flex-basis
  • Revision title: flex-basis
  • Revision id: 7475
  • Created:
  • Creator: FredB
  • Is current revision? No
  • Comment 11 words added

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The flex-basis CSS property specifies the flex basis which is the initial main size of a flex item.

  • {{ Xref_cssinitial() }}:auto
  • Applies to: flex items
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}:as specified, with lengths made absolute

See Using CSS flexible boxes for more properties and information.

Syntax

Formal grammar: <'width'>

flex-basis: value

Values

percentage
Computed value returns a percentage of the parent flex container main size property. Negative values are invalid.
absolute length
Defined as a number followed by a absolute unit such as px, mm or pt. Negative values are invalid.
initial
Refers to the default value of the property.
auto
The computed value of flex-basis equals the computed value of the main size of the flex item.
Note: Writing Modes Level 3 specification will introduce the following new keywords: min-content, max-content, fill-available and fit-content.
Note: flex-basis determines the size of the content-box unless specified otherwise using {{ Cssxref("box-sizing") }}.

Examples

element { 
  flex-basis: 18em;
}

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 id="Summary">Summary</h2>
<p>The <code>flex-basis</code> <a href="/en/CSS" title="CSS">CSS</a> property specifies the flex basis which is the initial <strong>main size</strong> of a flex item.</p>
<nobr>
<ul class="cssprop"> <li><dfn>{{ Xref_cssinitial() }}:</dfn><code>auto</code></li> <li><dfn>Applies to:</dfn> flex items</li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn>as specified, with lengths made absolute</li>
</ul>
</nobr>
<p><nobr>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.</nobr></p><nobr>
</nobr><p><nobr></nobr><nobr></nobr></p><h2 id="Syntax"><nobr>Syntax</nobr></h2><nobr>
</nobr><pre class="twopartsyntaxbox"><nobr></nobr><nobr>Formal grammar: &lt;'width'&gt;
</nobr>
</pre>
<nobr> </nobr>
<pre><nobr>flex-basis: <em>value</em>
</nobr>
</pre>
<h3 id="Values">Values</h3>
<dl> <dt><code>percentage</code></dt> <dd>Computed value returns a percentage of the parent flex container main size property. Negative values are invalid.</dd> <dt><code>absolute length</code></dt> <dd>Defined as a number followed by a absolute unit such as <code>px</code>, <code>mm</code> or <code>pt</code>. Negative values are invalid.</dd> <dt><code>initial</code></dt> <dd>Refers to the default value of the property.</dd> <dt><code>auto</code></dt> <dd>The computed value of <code>flex-basis</code> equals the computed value of the main size of the flex item.</dd>
</dl>
<div class="note"><strong>Note:</strong> Writing Modes Level 3 specification will introduce the following new keywords: <code>min-content</code>, <code>max-content</code>, <code>fill-available</code> and <code>fit-content</code>.</div>
<div class="note"><strong>Note:</strong> <code>flex-basis</code> determines the size of the content-box unless specified otherwise using {{ Cssxref("box-sizing") }}.</div><h2 id="Examples">Examples</h2>
<pre>element { 
  flex-basis: 18em;
}
</pre>
<h2 id="Specifications" 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-basis0" title="http://dev.w3.org/csswg/css3-flexbox/#flex-basis0">CSS Flexible Box Layout Module</a></td> <td>{{ Spec2('CSS3 Flexbox') }}</td> <td> </td> </tr> </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ page{path: "/en/CSS/Using_CSS_flexible_boxes", section: "Browser compatibility"} }}</p><h2 id="See_also">See also</h2>
<p><nobr></nobr></p>
Revert to this revision