css3-flexbox/Overview.src.html

Sun, 11 Mar 2012 16:37:02 -0700

author
Alex Mogilevsky <alexmog@microsoft.com>
date
Sun, 11 Mar 2012 16:37:02 -0700
changeset 4724
c515c530ea37
parent 4708
166bd5c52fbd
child 4725
d3362b8a88c8
permissions
-rw-r--r--

fix typos

     1 <!DOCTYPE html>
     2 <html lang="en">
     3 <head>
     4 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     5 	<title>CSS Flexible Box Layout Module</title>
     6 	<link rel="stylesheet" type="text/css" href="http://dev.w3.org/csswg/default.css">
     7 	<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED">
     8 	<style>
     9 	code.one-line { white-space: pre; }
    10 	.code-and-figure {
    11 		display: table;
    12 		margin: 0 auto;
    13 		border-spacing: 1em;
    14 	}
    15 	.code-and-figure > div {
    16 		display: table-cell;
    17 		vertical-align: middle;
    18 	}
    19 	</style>
    20 </head><body>
    22 <div class="head">
    23 	<!--logo-->
    25 	<h1 id="head-box-flexible">CSS Flexible Box Layout Module</h1>
    26 	<h2 class="no-num no-toc" id="w3c-working">[LONGSTATUS], [DATE]</h2>
    28 	<dl>
    29 		<dt>This version:
    30 		<!--<dd><a href="[VERSION]">[VERSION]</a>-->
    31 		<dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
    33 		<dt>Latest version:
    34 		<!--<dd><a href="[LATEST]">[LATEST]</a>-->
    35 		<dd><a href="http://www.w3.org/TR/css3-flexbox/">http://www.w3.org/TR/css3-flexbox/</a>
    37 		<dt>Editor's Draft:
    38 		<dd><a href="http://dev.w3.org/csswg/css3-flexbox/">http://dev.w3.org/csswg/css3-flexbox/</a>
    40 		<dt>Previous versions:
    41 		<dd><a href="http://www.w3.org/TR/2011/WD-css3-flexbox-20111129/">http://www.w3.org/TR/2011/WD-css3-flexbox-20111129/</a>
    42 		<dd><a href="http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/">http://www.w3.org/TR/2011/WD-css3-flexbox-20110322/</a>
    43 		<dd><a href="http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/">http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/</a>
    45 		<dt>Issues List:</dt>
    46         <dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Flexbox&resolution=---">Bugzilla Bugs for Flexbox</a></dd>
    48 		<dt>Discussion:</dt>
    49 		<dd><a href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a> with subject line "<code>[css3-flexbox] …message topic…</code>"
    51 		<dt>Editors:
    52 		<dd><a href="http://www.xanthir.com/contact">Tab Atkins Jr.</a>, Google Inc.</dd>
    53 		<dd>Alex Mogilevsky, Microsoft Corporation, <a href="mailto:alexmog@microsoft.com">alexmog@microsoft.com</a>
    54 		<dd>L. David Baron, Mozilla Corporation, <a href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>
    56 		<dt>Authors and former editors:
    57 		<dd>Neil Deakin, Mozilla Corporation, <a href="mailto:enndeakin@gmail.com">enndeakin@gmail.com</a>
    58 		<dd>Ian Hickson, formerly of Opera Software, <a href="mailto:ian@hixie.ch">ian@hixie.ch</a>
    59 		<dd>David Hyatt, formerly of Netscape Corporation, <a href="mailto:hyatt@apple.com">hyatt@apple.com</a>
    60 	</dl>
    61 	<!--copyright-->
    63 	<hr title="Separator for header">
    64 </div>
    66 <h2 class="no-num no-toc" id="abstract">
    67 Abstract</h2>
    69 	<p>The specification describes a CSS box model optimized for user interface design. In the flexbox layout model, the children of a flexbox can be laid out in any direction, and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent.  Both horizontal and vertical alignment of the children can be easily manipulated. Nesting of these boxes (horizontal inside vertical, or vertical inside horizontal) can be used to build layouts in two dimensions.</p>
    71 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    72 <!--status-->
    74 <h2 class="no-num no-toc" id="table">Table of contents</h2>
    75 <!--toc-->
    78 <h2 id="intro">
    79 Introduction</h2>
    81 	<p><em>This section is not normative.</em>
    83 	<p>CSS 2.1 defined four layout modes &mdash; algorithms which determine the size and position of boxes based on their relationships with their sibling and ancestor boxes: block layout, designed for laying out documents; inline layout, designed for laying out text; table layout, designed for laying out information in a tabular format; and positioned layout, designed for very explicit positioning without much regard for other elements in the document. This module introduces a new layout mode, flexbox layout, which is designed for laying out more complex applications and webpages.</p>
    85 	<p>Flexbox layout is superficially similar to block layout.  It lacks many of the more complex text or document-formatting properties that can be used in block layout, such as 'float' and 'columns', but in return it gains more simple and powerful tools for aligning its contents in ways that webapps and complex web pages often need.  </p>
    87     <p>The contents of a flexbox can be laid out in any direction (left, right, down, or even up!), can have their order swapped around dynamically (i.e., display order is independent of source order), and can "flex" their sizes and positions to respond to the available space.  If a flexbox is <i>multi-line</i>, the flexbox items flow in two dimensions, wrapping into separate lines in a fashion similar to how text is wrapped into multiple lines.</p>
    89 	<div class="example">
    90 		<p>For example, the following HTML snippet uses flexbox to create a toolbar with icons.  The flexbox is horizontal, and the children's widths don't fill the flexbox's width, so the additional space is distributed around and between the children.  As the flexbox grows (perhaps because the user is viewing the page on a wider screen), the children spread out evenly and automatically:</p>
    92 		<pre>
    93 &lt;ul>
    94   &lt;li>&lt;button>&lt;img src='new.svg' alt="New">&lt;/button>&lt;/li>
    95   &lt;li>&lt;button>&lt;img src='upload.svg' alt="Upload">&lt;/button>&lt;/li>
    96   &lt;li>&lt;button>&lt;img src='save.svg' alt="Save">&lt;/button>&lt;/li>
    97   &lt;li>&lt;button>&lt;img src='trash.svg' alt="trash">&lt;/button>&lt;/li>
    98 &lt;/ul>
    99 &lt;style>
   100 ul { display: flexbox; flex-pack: distribute; }
   101 /* Irrelevant styling for this example removed. */
   102 &lt;/style></pre>
   104 		<div class='figure'>
   105 			<img src="images/toolbar-example.svg" width=400 height=140>
   106 			<p class='caption'>Example rendering of the above code snippet, at two different flexbox widths.</p>
   107 		</div>
   108 	</div>
   110 <h3 id="placement">
   111 Module interactions</h3>
   113 	<p>This module extends the definition of the 'display' property.
   115 <h3 id="values">
   116 Values</h3>
   118 	<p>This specification follows the <a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property definition conventions</a> from [[!CSS21]]. Value types not defined in this specification are defined in CSS Level 2 Revision 1 [[!CSS21]]. Other CSS modules may expand the definitions of these value types: for example [[CSS3COLOR]], when combined with this module, expands the definition of the &lt;color&gt; value type as used in this specification.</p>
   120 	<p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the <a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">''inherit''</a> keyword as their property value. For readability it has not been repeated explicitly.
   122 <h2 id='box-model'>
   123 The Flexbox Box Model</h2>
   125 	<p>An element with ''display:flexbox'' or ''display:inline-flexbox'' is a <dfn>flexbox</dfn>.  Children of a flexbox are called <dfn title="flexbox item|flexbox items|flexbox item's" id="flexbox-item">flexbox items</dfn> and are laid out using the flexbox box model.</p>
   127 	<p>Unlike block layout, which is normally biased towards laying things out vertically, and inline layout, which is normally biased toward laying things out horizontally, the flexbox layout algorithm is agnostic as to the direction the flexbox happens to be laid out in.  To make it easier to talk about flexbox layout in a general way, we will define several direction-agnostic terms here to make the rest of the spec easier to read and understand.</p>
   129 	<div class='figure'>
   130 		<img src='images/flex-direction-terms.svg' width=510 height=300>
   131 		<p class='caption'>An illustration of the various directions and sizing terms used in this specification, respectively for ''row'' and ''column'' flexboxes.</p>
   132 	</div>
   134 	<p>The <dfn>main axis</dfn> of a flexbox is the axis on which <i>flexbox items</i> are laid out along.  The <i>flexbox items</i> are ordered such that they start on the <dfn>main-start</dfn> side of the flexbox, and go toward the <dfn>main-end</dfn> side.  A <i>flexbox item's</i> width or height, whichever is in the <i>main axis</i>, is the item's <dfn>main size</dfn>.  The <i>flexbox item's</i> <dfn>main size property</dfn> is either the 'width' or 'height' property, whichever is in the <i>main axis</i>.</p>
   136 	<p>The axis perpendicular to the <i>main axis</i> is called the <dfn>cross axis</dfn>, and similarly has <dfn>cross-start</dfn> and <dfn>cross-end</dfn> directions and sides defined.  The width or height of a <i>flexbox item</i>, whichever is in the <i>cross axis</i>, is the item's <dfn>cross size</dfn>, and similarly the <dfn>cross size property</dfn> is whichever of 'width' or 'height' that is in the <i>cross axis</i>.</p>
   138 	<p>The contents of a flexbox can be easily and powerfully manipulated with a handful of properties.  Most significantly, <i>flexbox items</i> can "flex" their <i>main size</i> by using the 'flex' property.  This "flexing" allows the items to get bigger or smaller based on the available space in the page.  If there is leftover space in the flexbox after all of the <i>flexbox items</i> have finished flexing, the items can be aligned, centered, or distributed with the 'flex-pack' property.  <i>Flexbox items</i> can also be completely rearranged within the flexbox with the 'flex-order' property.</p>
   140 	<p>In the <i>cross axis</i>, <i>flexbox items</i> can either "flex" to fill the available space or be aligned within the space with the 'flex-align' property.  If a flexbox is <i>multi-line</i>, new lines are added in the <i>cross-end</i> direction, and can similarly be aligned, centered, or distributed within the flexbox with the 'flex-line-pack' property.</p>
   143 <h2 id='display-flexbox'>
   144 New values for 'display' property</h2>
   146 	<table class="propdef">
   147 		<tr>
   148 			<th>Name:
   149 			<td>display
   150 		<tr>
   151 			<th><a href="http://dev.w3.org/csswg/css-module/#values">New value</a>:
   152 			<td>flexbox | inline-flexbox
   153 	</table>
   155 	<p>You can declare that an element is a flexbox, and thus should use flexbox layout for its contents, by setting the 'display' property on the element to the value 'flexbox' or 'inline-flexbox'.</p>
   157 	<p>The ''flexbox'' value makes the flexbox a block-level element.  The ''inline-flexbox'' value makes the flexbox an inline-level element.  When it is necessary to distinguish them, this specification will refer to the former kind of flexbox as a <dfn id="block-flexbox" title="block flexbox|block flexboxes">block flexbox</dfn> and the latter type as an <dfn id="inline-flexbox" title="inline flexbox|inline flexboxes">inline flexbox</dfn>.</p>
   159 	<p>Flexboxes use a new layout algorithm, and so some properties that were designed with the assumption of block layout don't make sense in a flexbox context.  In particular:</p>
   161 	<ul>
   162 		<li>all of the 'column-*' properties in the Multicol module have no effect on a flexbox.</li>
   164 		<li>'float' and 'clear' have no effect on a flexbox item.  Using 'float' on an element still causes that element's 'display' property to compute to ''block'', as normal, because that occurs before flexbox items are determined (the algorithm for wrapping children of a flexbox into <i>flexbox items</i> needs the computed value of 'display').</li>
   166 		<li>'vertical-align' has no effect on the alignment of a flexbox item in the flexbox</li>
   167 	</ul>
   169 	<p>If an element's specified value for 'display' is ''inline-flexbox'' and the element is floated or absolutely positioned, the computed value of 'display' must be ''flexbox''.</p>
   171 	<p>A flexbox establishes a new <dfn>flexbox formatting context</dfn> for its contents.  This is similar to a block formatting context root: floats do not intrude into the flexbox, and the flexbox's margins do not collapse with the margins of its contents.  Additionally, each of the <i>flexbox items</i> establish a new formatting context for its contents.</p>
   173 <h2 id='flex-items'>
   174 Flexbox Items</h2>
   176 	<p>Flexbox layout algorithm operates on <i>flexbox items</i>, which are boxes that satisfy at least one of the following criteria:</p>
   178 	<ol>
   179 		<li>Immediate block-level children of flexbox</li>
   181 		<li>Atomic inline-level children of flexbox</li>
   183 		<li>Contiguous run of non-replaced inline children, wrapped into an anonymous box</li>
   184 	</ol>
   186 	<p>Some values of 'display' trigger "fixup" to ensure a sensible tree structure.  For example, a lone ''table-cell'' box is fixed up by generating ''table'', ''table-row-group'', and ''table-row'' boxes around it.  This fixup must occur <em>before</em> a flexbox's contents are checked to see if it's necessary to generate anonymous flexbox items.</p>
   188 	<p class='note'>In the future, other kinds of fixup such as ''display:run-in'' or ''display:ruby'' should also run before flexbox fixup.</p>
   190 	<div class="example">
   191 		<p>Examples of flexbox items:</p>
   192 		<pre>
   193 &lt;div style="display:flexbox">
   195     &lt;!-- flexbox item: block-level child -->
   196     &lt;div id="item1">block&lt;/div>
   198     &lt;!-- not a flexbox item, because it's out-of-flow -->
   199     &lt;div id="not-an-item1.5" style="position: absolute;">block&lt;/div>
   201     &lt;!-- flexbox item: block-level child -->
   202     &lt;div id="item2" style="display:table">table&lt;/div>
   204     &lt;!-- flexbox item: anonymous table wrapped around table-cell -->
   205     &lt;div id="item3" style="display:table-cell">table-cell&lt;/div> 
   207     &lt;!-- flexbox item: anonymous block around inline content -->
   208     anonymous item 4
   210     &lt;!-- flexbox item: block-level child -->
   211     &lt;div id="item5">block&lt;/div>
   213     &lt;!-- flexbox item: anonymous block around inline content -->
   214     anonymous item 6.1
   215     &lt;span id="item6.1">
   216         text 6.2
   217         &lt;div id="not-an-item6.3">block&lt;/div>
   218         text 6.4
   219     &lt;/span>
   221     &lt;!-- flexbox item: block-level replaced element -->
   222     &lt;iframe id="item7"></iframe>
   224     &lt;!-- flexbox item: inline-level replaced element -->
   225     &lt;img id="item7" style="display:inline">
   227     &lt;!-- flexbox item: inline-level replaced element -->
   228     &lt;button id="item8">button&lt;/button>
   230     &lt;!-- flexbox item: inline-table -->
   231     &lt;div id="item9" style="display:inline-table">table&lt;/div>
   233     &lt;!-- flexbox item: floated inline, which changes to a block -->
   234     &lt;span id="item10" style="float: left;">span&lt;/span>
   235 &lt;/div></pre>
   237 		<p>Notice that block element "not-an-item6.3" is not a separate flexbox item, because it is contained inside an inline element which is being wrapped into an anonymous flex item.  Similarly, the block element "not-an-item1.5" is not a flexbox item, because it's absolutely positioned and thus out of flow.</p>
   238 	</div>
   240 <h3 id='abspos-flexbox-items'>
   241 Absolutely Positioned Flexbox Children</h3>
   243 	<p>Absolutely positioned children of a flexbox are not <i>flexbox items</i>, but they leave behind "placeholders" in their normal position in the box tree.  These placeholders are anonymous inline boxes with a width and height of ''0px'', and they interact normally with the flexbox layout algorithm.  In particular, they'll trigger the creation an anonymous flexbox item wrapper boxes, or join neighboring inline elements in <em>their</em> anonymous flexbox item wrapper boxes.</p>
   245 	<p>The "static position" of an absolutely positioned child of a flexbox (the position when the 'top'/'right'/'bottom'/'left' properties are ''auto''), then, is the final position of their corresponding placeholder, after flexbox layout has been performed.</p>
   247 	<p class='note'>Note: In most cases, this means that absolutely positioned items will have no effect on flexbox layout, even if they force the generation of an anonymous flexbox item wrapper, because those wrapper items will also collapse to zero size and have no effect.  The only exception is when the flexbox has ''flex-pack:justify'', in which case the anonymous flexbox item will cause there to be two packing spaces where there would otherwise be only one, which will appear as a double-size space between two "real" items.</p>
   250 <h2 id='multi-line'>
   251 Multi-line Flexbox</h2>
   253 	<p>A flexbox can be either <i>single-line</i> or <i>multi-line</i>, depending on the 'flex-wrap' property.  A <dfn>single-line</dfn> flexbox lays out all of its children in a single line, even if that would cause the flexbox to overflow its bounds.  A <dfn>multi-line</dfn> flexbox breaks its <i>flexbox items</i> across multiple lines to avoid overflowing, similar to how text is broken onto a new line when it gets too wide to fit on the existing line.  Every line contains at least one <i>flexbox item</i>, unless the flexbox itself is completely empty.</p>
   255 	<p>When additional lines are created, they are stacked in the flexbox in the <i>cross axis</i>.  Each line is completely independent; flexible lengths and the 'flex-pack' and 'flex-align' properties only consider the items on a single line at a time.  The <i>main size</i> of a line is the same as the <i>main size</i> of the flexbox's content box.  The <i>cross size</i> of a line depends on whether the flexbox is <i>single-line</i> or <i>multi-line</i>: the <i>cross size</i> of the sole line in a <i>single-line</i> flexbox is the same as the <i>cross size</i> of the flexbox's content box, while the <i>cross size</i> of a line in a <i>multi-line</i> flexbox is the minimum size necessary to contain the <i>flexbox items</i> on the line, after aligning them with 'flex-align'.  The lines themselves are then aligned within a flexbox with the 'flex-line-pack' property.</p>
   257 	<div class=example>
   258 		<p>This example shows four buttons that do not fit horizontally.</p>
   260 		<pre>&lt;style>
   261 #div1 {
   262 	display: flexbox;
   263 	flex-flow: row wrap;
   264 	width: 300px;
   265 }
   266 button {
   267 	flex:80px 1;
   268 }
   269 &lt;style>
   271 &lt;div id="div1">
   272 	&lt;button id="button1">Elephant&lt;/button>
   273 	&lt;button id="button2">Tiger&lt;/button>
   274 	&lt;button id="button3">Antelope&lt;/button>
   275 	&lt;button id="button4">Wildebeest&lt;/button>
   276 &lt;/div></pre>
   278 		<p>The buttons are first set to their preferred widths, in this case 80 pixels. This will allow the first three buttons to fit in 240 pixels with 60 pixels left over of remaining space. Because the 'flex-flow' property specifies a multi-line flexbox (due to the ''wrap'' keyword appearing in its value), the flexbox will create an additional line to contain the last button.</p>
   280 		<p>Flexibility is applied to each element, separately for each line. The first line has 60 pixels of remaining space and all of the buttons have the same flexibility, so each of the three buttons on that line will receive 20 pixels of extra width, ending up 100px wide. The remaining button is on a line of its own and will stretch to the entire width of the line, or 300 pixels.</p>
   282 		<div style="width:300px; border:medium solid green; overflow: hidden;">
   283 			<button style="width:100px; float: left;">Elephant</button>
   284 			<button style="width:100px; float: left;">Tiger</button>
   285 			<button style="width:100px; float: left;">Antelope</button>
   286 			<button style="width:300px; float: left;">Wildebeest</button>
   287 		</div>
   289 		<p>If the box was resized, the buttons may rearrange onto different lines as necessary.</p>
   291 		<p>If the style rules in the example above were changed to the following:</p>
   293 		<pre>
   294 #div1 {
   295 	display: flexbox;
   296 	flex-flow: row wrap;
   297 	flex-pack: center;
   298 	width: 300px;
   299 }
   300 button {
   301 	flex:80px 1;
   302 	max-width: 90px;
   303 }</pre>
   305 		<p>Similar to the previous example, the first three buttons will fit on the first line, and the last button will wrap onto a new line.  However, when the buttons attempt to flex they can only grow to 90px each, due to their 'max-width' property.  This leaves 30px of free space on the first line and 210px of free space on the second line.  Because 'flex-pack' is set to ''center'', the buttons will be centered on each line, with the free space split equally on either side.</p>
   307 		<div style="width:300px; border:medium solid green; text-align:center;">
   308 			<button style="width:90px; float: left; margin-left: 15px;">Elephant</button>
   309 			<button style="width:90px; float: left;">Tiger</button>
   310 			<button style="width:90px; float: left;">Antelope</button>
   311 			<button style="width:90px">Wildebeest</button>
   312 		</div>
   313 	</div>
   315 <h2>
   316 Ordering and Orientation</h2>
   318 	<p>The first level of flexbox functionality is the ability to lay out a flexbox's contents in any direction and in any order.  This allows an author to trivially achieve effects that would previously have required complex or fragile methods, such as using the 'float' property to lay out a horizontal navigation bar (which then requires further effort with the 'clear' property or others to make the elements interact nicely with the rest of the page).  This functionality is exposed through the 'flex-flow' and 'flex-order' properties.</p>
   320 <h3 id='flex-direction'>
   321 Flexbox Flow Direction: the 'flex-direction' property</h3>
   323 	<table class=propdef>
   324 		<tr>
   325 			<th>Name:</th>
   326 			<td><dfn>flex-direction</dfn>
   327 		<tr>
   328 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   329 			<td>row | row-reverse | column | column-reverse
   330 		<tr>
   331 			<th>Initial:
   332 			<td>row
   333 		<tr>
   334 			<th>Applies To:
   335 			<td>flexboxes
   336 		<tr>
   337 			<th>Inherited:
   338 			<td>no
   339 		<tr>
   340 			<th>Computed Value:
   341 			<td>specified value
   342 		<tr>
   343 			<th>Media:
   344 			<td>visual
   345 		<tr>
   346 			<th>Animatable:
   347 			<td>no
   348 	</table>
   350 	<p>The 'flex-direction' property specifies how <i>flexbox items</i> are placed in the flexbox, by setting the direction of the flexbox's <i>main axis</i>.  This affects the direction that flexbox items are laid out in, and the meaning of the 'flex-pack' property.</p>
   352 	<dl>
   353 		<dt><dfn id='flex-flow-row'>row</dfn></dt>
   354 		<dd>The flexbox's <i>main axis</i> has the same orientation as the inline axis of the current writing mode (the direction that text is laid out in).  The <i>main-start</i> and <i>main-end</i> directions are equivalent to the "start" and "end" directions, respectively, of the current writing mode.</dd>
   356 		<dt><dfn id='flex-flow-row-reverse'>row-reverse</dfn></dt>
   357 		<dd>Same as <i>row</i>, except the <i>main-start</i> and <i>main-end</i> directions are swapped.</dd>
   359 		<dt><dfn id='flex-flow-column'>column</dfn></dt>
   360 		<dd>The flexbox's <i>main axis</i> has the same orientation as the block axis of the current writing mode (the direction that blocks are laid out in).  The <i>main-start</i> and <i>main-end</i> directions are equivalent to the "before" and "after" directions, respectively, of the current writing mode.</dd>
   362 		<dt><dfn id='flex-flow-column-reverse'>column-reverse</dfn></dt>
   363 		<dd>Same as <i>column</i>, except the <i>main-start</i> and <i>main-end</i> directions are swapped.</dd>
   364 	</dl>
   366 <h3 id='flex-wrap'>
   367 Flexbox Wrapping: the 'flex-wrap' property</h3>
   369 	<table class=propdef>
   370 		<tr>
   371 			<th>Name:</th>
   372 			<td><dfn>flex-wrap</dfn>
   373 		<tr>
   374 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   375 			<td>nowrap | wrap | wrap-reverse
   376 		<tr>
   377 			<th>Initial:
   378 			<td>nowrap
   379 		<tr>
   380 			<th>Applies To:
   381 			<td>flexboxes
   382 		<tr>
   383 			<th>Inherited:
   384 			<td>no
   385 		<tr>
   386 			<th>Computed Value:
   387 			<td>specified value
   388 		<tr>
   389 			<th>Media:
   390 			<td>visual
   391 		<tr>
   392 			<th>Animatable:
   393 			<td>no
   394 	</table>
   396 	<p>The 'flex-wrap' property controls whether the flexbox is <i>single-line</i> or <i>multi-line</i>, and the direction of the <i>cross axis</i>, which affects the direction new lines are stacked in and the meaning of the 'flex-align', 'flex-item-align', and 'flex-line-pack' properties.</p>
   398 	<dl>
   399 		<dt>nowrap</dt>
   400 		<dd>The flexbox is <i>single-line</i>.  The <i>cross-start</i> direction is equivalent to either the "start" or "before" direction of the current writing mode, whichever is in the <i>cross-axis</i>, and the <i>cross-end</i> direction is the opposite direction of <i>cross-start</i>.
   401 			</dd>
   403 		<dt><dfn id='flex-flow-wrap'>wrap</dfn></dt>
   404 		<dd>The flexbox is <i>multi-line</i>.  The <i>cross-start</i> direction is equivalent to either the "start" or "before" direction of the current writing mode, whichever is in the <i>cross-axis</i>, and the <i>cross-end</i> direction is the opposite direction of <i>cross-start</i>.</dd>
   406 		<dt><dfn id='flex-flow-wrap-reverse'>wrap-reverse</dfn></dt>
   407 		<dd>Same as <i>wrap</i>, except the <i>cross-start</i> and <i>cross-end</i> directions are swapped.</dd>
   408 	</dl>
   410 <h3 id='flex-flow'>
   411 Flex Direction and Wrap: the 'flex-flow' shorthand</h3>
   413 	<table class=propdef>
   414 		<tr>
   415 			<th>Name:</th>
   416 			<td><dfn>flex-flow</dfn>
   417 		<tr>
   418 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   419 			<td>&lt;&apos;flex-direction&apos;> || &lt;&apos;flex-wrap&apos;>
   420 		<tr>
   421 			<th>Initial:
   422 			<td>see individual properties
   423 		<tr>
   424 			<th>Applies To:
   425 			<td>flexboxes
   426 		<tr>
   427 			<th>Inherited:
   428 			<td>see individual properties
   429 		<tr>
   430 			<th>Computed Value:
   431 			<td>see individual properties
   432 		<tr>
   433 			<th>Media:
   434 			<td>visual
   435 		<tr>
   436 			<th>Animatable:
   437 			<td>no
   438 	</table>
   440 	<p>The 'flex-flow' property is a shorthand for setting the 'flex-direction' and 'flex-wrap' properties together.</p>
   442 	<div class="example">
   443 		<p>Some examples of valid flows:</p>
   445 		<table style="margin: 0 auto; vertical-align: middle; border-spacing: 2em 1em;">
   446 			<tr>
   447 				<td><pre>
   448 div { flex-flow: row; }
   449 /* Initial value. Main axis is 
   450    inline, no wrap. */</pre>
   451 				<td><img src='images/flex-flow1.svg' width=240 height=80>
   452 			<tr>
   453 				<td><pre>
   454 div { flex-flow: column wrap; }
   455 /* Main axis is block-direction and lines
   456    wrap in the inline direction.  For an 
   457    English page, the main axis is top-to-bottom
   458    and lines wrap to the right. */</pre>
   459 				<td><img src='images/flex-flow2.svg' width=170 height=200>
   460 			<tr>
   461 				<td><pre>
   462 div { writing-mode: vertical-rl;
   463       flex-flow: column wrap-reverse; }
   464 /* Main axis is block direction (right to 
   465    left). New lines wrap upwards. */</pre>
   466 				<td><img src='images/flex-flow3.svg' width=200 height=170>
   467 		</table>
   468 	</div>
   471 <h3 id='flex-order'>
   472 Display Order: the 'flex-order' property</h3>
   474 	<p><i>Flexbox items</i> are, by default, displayed and laid out in the same order as they appear in the source document.  The 'flex-order' property may be used to change this ordering.</p>
   476 	<table class=propdef>
   477 		<tr>
   478 			<th>Name:
   479 			<td><dfn>flex-order</dfn>
   480 		<tr>
   481 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   482 			<td>&lt;number>
   483 		<tr>
   484 			<th>Initial:
   485 			<td>0
   486 		<tr>
   487 			<th>Applies to:
   488 			<td><i>flexbox items</i></td>
   489 		<tr>
   490 			<th>Inherited:
   491 			<td>no
   492 		<tr>
   493 			<th>Computed value:
   494 			<td>specified value
   495 		<tr>
   496 			<th>Media:
   497 			<td>visual
   498 		<tr>
   499 			<th>Animatable:
   500 			<td>yes
   501 	</table>
   503 	<p>The 'flex-order' property assigns <i>flexbox items</i> to ordinal groups.</p>
   505 	<p>Ordinal groups control the order in which <i>flexbox items</i> appear.  A flexbox will lay out its content starting from the lowest numbered ordinal group and going up.  Items with the same ordinal group are laid out in the order they appear in the source document.  'flex-order' has no effect on stacking/layering; elements must still be drawn over/under each other based on document order, 'z-index', and other relevant means.</p>
   507 	<div class='example'>
   508 		<p>The following figure shows a simple tabbed interface, where the tab for the active pane is always in front:</p>
   510 		<div class='figure'><img src="images/flex-order-example.png"></div>
   512 		<p>This could be implemented with the following CSS (showing only the flexbox-relevant code):</p>
   514 		<pre>
   515 .tabs {
   516 	display: flexbox;
   517 }
   518 .tabs > .current {
   519 	flex-order: -1; /* Lower than the default of 0 */
   520 }</pre>
   522 	</div>
   524 	<div class='example'>
   525 		<p>Many web pages have a similar shape in the markup, with a header on top, a footer on bottom, and then a content area and one or two additional columns in the middle.  Generally, it's desirable that the content come first in the page's source code, before the additional columns.  However, this makes many common designs, such as simply having the additional columns on the left and the content area on the right, difficult to achieve.  This has been addressed in many ways over the years, often going by the name "Holy Grail Layout" when there are two additional columns.  'flex-order' makes this trivial.  For example, take the following sketch of a page's code and desired layout:</p>
   527 		<div class='code-and-figure'>
   528 			<div><pre>
   529 &lt;!DOCTYPE html>
   530 &lt;header>...&lt;/header>
   531 &lt;div id='main'>
   532    &lt;article>...&lt;/article>
   533    &lt;nav>...&lt;/nav>
   534    &lt;aside>...&lt;/aside>
   535 &lt;/div>
   536 &lt;footer>...&lt;/footer></pre></div>
   537 			<div><img src="images/flex-order-page.svg" width=400 height=360></div>
   538 		</div>
   540 		<p>This layout can be easily achieved with Flexbox:</p>
   542 		<pre>
   543 #main { display: flexbox; }
   544 #main > article { flex:1;         flex-order: 2; }
   545 #main > nav     { width: 200px;   flex-order: 1; }
   546 #main > aside   { width: 200px;   flex-order: 3; }</pre>
   548 		<p>As an added bonus, the columns will all be equal-height by default, and the main content will be as wide as necessary to fill the screen.  Additionally, this can then be combined with media queries to switch to an all-vertical layout on narrow screens:</p>
   550 		<pre>
   551 @media all and (max-width: 600px) {
   552 	/* Too narrow to support three columns */
   553 	#main { flex-flow: column; }
   554 	#main > article, #main > nav, #main > aside {
   555 		/* Return them to document order */
   556 		flex-order: 0; width: auto;
   557 	}
   558 }</pre>
   560 		<p><small>(Further use of multiline flexboxes to achieve even more intelligent wrapping left as an exercise for the reader.)</small></p>
   561 	</div>
   564 <h2 id='flexibility'>
   565 Flexibility: the 'flex' property</h2>
   567 	<p>The defining aspect of flexbox layout is the ability to make the <i>flexbox items</i> "flex", altering their width or height to fill the available space. This is done by using a 'flex' property. A flexbox distributes free space to its items proportional to their positive flexibility, or shrinks them to prevent overflow proportional to their negative flexibility.</p>
   569 	<table class=propdef>
   570 		<tr>
   571 			<th>Name:
   572 			<td><dfn>flex</dfn>
   573 		<tr>
   574 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   575 			<td>[ [ &lt;pos-flex> &lt;neg-flex>? ] || &lt;preferred-size> ] | none 
   576 		<tr>
   577 			<th>Initial:
   578 			<td>none
   579 		<tr>
   580 			<th>Applies to:
   581 			<td>flexbox items
   582 		<tr>
   583 			<th>Inherited:
   584 			<td>no
   585 		<tr>
   586 			<th>Computed Value:
   587 			<td>specified value
   588 		<tr>
   589 			<th>Media:
   590 			<td>visual
   591 		<tr>
   592 			<th>Animatable:
   593 			<td>yes
   594 	</table>
   596 	<p>The 'flex' property specifies the parameters of a <dfn title="flexible length|flexible lengths|flexible length's">flexible length</dfn>: the <dfn id="positive-flexibility" title="positive flexibility">positive</dfn> and <dfn>negative flexibility</dfn>, and the <dfn>preferred size</dfn>.</p>
   598 	<p><code>&lt;pos-flex></code> and <code>&lt;neg-flex></code> are non-negative <code>&lt;number>s</code>. The <code>&lt;pos-flex></code> component sets the <i>positive flexibility</i>; if omitted, the <i>positive flexibility</i> defaults to ''1''. The <code>&lt;neg-flex></code> component sets the <i>negative flexibility</i>; if omitted, it defaults to ''0''.  </p>
   599 <p> The <code>&lt;preferred-size></code> component sets the preferred size. It can be set to any value that would be valid in the 'width' or 'height' property, 
   600 	except values that are not applicable to a component value (of values 
   601 	defined in CSS2.1, only &#39;inherit&#39; is not valid for <code>&lt;preferred-size></code>; in the future other values may be introduced that are not applicable as length component). 
   602 If omitted, the preferred size defaults to ''0px''. If set to 'auto', the value of 'width' or 'height' (whichever is in parallel to main axis) is used as preferred size.</p>
   603 <p> &nbsp;If the <code>&lt;preferred-size></code> is ''0'', it <strong>must</strong> be specified with a unit (like ''0px'') to avoid ambiguity; unitless zero will either be interpreted as as one of the flexibilities, or is a syntax error.</p>
   605 	<p>The keyword 'none' is equivalent to "0 0 auto". </p>
   608 	<p>A ''&lt;flex>'' value is transitionable, by transitioning the <i>preferred size</i>, <i>positive flexibility</i>, and <i>negative flexibility</i> independently.  ''&lt;flex>'' can also transition to and from a &lt;length>, by treating the length as if it were a flexible length with a positive and negative flexibility of zero and a preferred size of the length.</p>
   610 	<div class='example'>
   611 		<p>Flexibility allows elements to respond directly to the available space, 
   612 		optionally taking into account size of content:</p>
   614 		<pre>
   615 &lt;!DOCTYPE html>
   616 &lt;style>
   617 	div { display:flexbox; outline:1px solid silver; }
   618 	p { flex:1 auto; margin:1em; background:gold; }
   619 &lt;/style&gt;
   620 &lt;div&gt;
   621 	&lt;p&gt;&quot;flexing&quot;&lt;/p&gt;
   622 	&lt;p&gt;allows the items to get bigger&lt;/p&gt;
   623 	&lt;p&gt;or&lt;/p&gt;
   624 	&lt;p&gt;smaller&lt;/p&gt;
   625 &lt;/div&gt;
   626 </pre>
   628 <img src="images/wp7zxxyu.gif" alt="items with equal flexibility extend by equal amount">
   630 </div> 
   632 <h2 id='alignment'>
   633 Alignment</h2>
   635 	<p>After a flexbox's contents have finished their flexing and dimensions of 
   636 	margin boxes of all flexbox items are finalized, they can be aligned in both the <i>main axis</i> with 'flex-pack' and the <i>cross axis</i> with 'flex-align' and 'flex-item-align'.  These properties make many common types of alignment trivial, including some things that were very difficult in CSS 2.1, like horizontal and vertical centering.</p>
   639 <h3 id='flex-pack'>
   640 Axis Alignment: the 'flex-pack' property</h3>
   642 	<table class=propdef>
   643 		<tr>
   644 			<th>Name:
   645 			<td><dfn>flex-pack</dfn>
   646 		<tr>
   647 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   648 			<td>start | end | center | justify | distribute
   649 		<tr>
   650 			<th>Initial:
   651 			<td>start
   652 		<tr>
   653 			<th>Applies to:
   654 			<td>flexboxes
   655 		<tr>
   656 			<th>Inherited:
   657 			<td>no
   658 		<tr>
   659 			<th>Computed Value:
   660 			<td>specified value
   661 		<tr>
   662 			<th>Media:
   663 			<td>visual
   664 		<tr>
   665 			<th>Animatable:
   666 			<td>no
   667 	</table>
   669 	<p>The 'flex-pack' property aligns <i>flexbox items</i> in the <i>main axis</i> of the current line of the flexbox.  This is done <em title=''>after</em> any flexible lengths 
   670 	and any auto margins have been resolved.  Typically it helps distribute extra free space leftover when either all the <i>flexbox items</i> on a line are inflexible, or are flexible but have reach their maximum size, but it also exerts some control over the alignment of items when they overflow the line.</p>
   672 	<dl>
   673 		<dt><dfn id='flex-pack-start'>start</dfn></dt>
   674 		<dd><i>Flexbox items</i> are packed toward the start of the line.  The <i>main-start</i> margin edge of the first <i>flexbox item</i> on the line is placed flush with the <i>main-start</i> edge of the line, and each subsequent <i>flexbox item</i> is placed flush with the preceding item.</dd>
   676 		<dt><dfn id='flex-pack-end'>end</dfn></dt>
   677 		<dd><i>Flexbox items</i> are packed toward the end of the line.  The <i>main-end</i> margin edge of the last <i>flexbox item</i> is placed flush with the <i>main-end</i> edge of the line, and each preceding <i>flexbox item</i> is placed flush with the subsequent item.</dd>
   679 		<dt><dfn id='flex-pack-center'>center</dfn></dt>
   680 		<dd><i>Flexbox items</i> are packed toward the center of the line.  The <i>flexbox items</i> on the line are placed flush with each other and aligned in the center of the line, with equal amounts of empty space between the <i>main-start</i> edge of the line and the first item on the line and between the <i>main-end</i> edge of the line and the last item on the line.  (If the leftover free-space is negative, the <i>flexbox items</i> will overflow equally in both directions.)</dd>
   682 		<dt><dfn id='flex-pack-justify'>justify</dfn></dt>
   683 		<dd><i>Flexbox items</i> are evenly distributed in the line.  If the leftover free-space is negative or there is only a single <i>flexbox item</i> on the line, this value is identical to ''start''.  Otherwise, the <i>main-start</i> margin edge of the first <i>flexbox item</i> on the line is placed flush with the <i>main-start</i> edge of the line, the <i>main-end</i> margin edge of the last <i>flexbox item</i> on the line is placed flush with the <i>main-end</i> edge of the line, and the remaining <i>flexbox items</i> on the line are distributed so that the empty space between any two adjacent items is the same.</dd>
   685 		<dt><dfn id='flex-pack-distribute'>distribute</dfn></dt>
   686 		<dd><i>Flexbox items</i> are evenly distributed in the line, with half-size spaces on either end.  If the leftover free-space is negative or there is only a single <i>flexbox item</i> on the line, this value is identical to ''center''.  Otherwise, the <i>flexbox items</i> on the line are distributed such that the empty space between any two adjacent <i>flexbox items</i> on the line is the same, and the empty space before the first and after the last <i>flexbox items</i> on the line are half the size of the other empty spaces.</dd>
   687 	</dl>
   689 	<div class="figure">
   690 		<img src="images/flex-pack.svg" width=504 height=270>
   691 		<p class='caption'>An illustration of the five 'flex-pack' keywords and their effects on a flexbox with three colored items.</p>
   692 	</div>
   695 <h3 id='flex-align'>
   696 Cross Axis Alignment: the 'flex-align' and 'flex-item-align' properties</h3>
   698 	<table class=propdef>
   699 		<tr>
   700 			<th>Name:
   701 			<td><dfn>flex-align</dfn>
   702 		<tr>
   703 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   704 			<td>start | end | center | baseline | stretch
   705 		<tr>
   706 			<th>Initial:
   707 			<td>stretch
   708 		<tr>
   709 			<th>Applies to:
   710 			<td>flexboxes
   711 		<tr>
   712 			<th>Inherited:
   713 			<td>no
   714 		<tr>
   715 			<th>Computed Value:
   716 			<td>specified value
   717 		<tr>
   718 			<th>Media:
   719 			<td>visual
   720 		<tr>
   721 			<th>Animatable:
   722 			<td>no
   723 	</table>
   725 	<table class=propdef>
   726 		<tr>
   727 			<th>Name:
   728 			<td><dfn>flex-item-align</dfn>
   729 		<tr>
   730 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   731 			<td>auto | start | end | center | baseline | stretch
   732 		<tr>
   733 			<th>Initial:
   734 			<td>auto
   735 		<tr>
   736 			<th>Applies to:
   737 			<td><i>flexbox items</i>
   738 		<tr>
   739 			<th>Inherited:
   740 			<td>no
   741 		<tr>
   742 			<th>Computed Value:
   743 			<td>''auto'' computes to parent's 'flex-align'; otherwise as specified
   744 		<tr>
   745 			<th>Media:
   746 			<td>visual
   747 		<tr>
   748 			<th>Animatable:
   749 			<td>no
   750 	</table>
   752 	<p><i>Flexbox items</i> can be aligned in the <i>cross axis</i> of the current line of the flexbox, similar to 'flex-pack' but in the perpendicular direction.  'flex-align' sets the default alignment for all of the flexbox's <i title="flexbox items">items</i>, including anonymous <i>flexbox items</i>.  'flex-item-align' allows this default alignment to be overridden for individual <i>flexbox items</i> (for anonymous flexbox items, 'flex-item-align' always matches the value of 'flex-align' on their associated flexbox).</p>
   754 	<p>A value of <dfn id="flex-item-align-auto">''auto''</dfn> for 'flex-item-align' computes to the value of 'flex-align' on the <i>flexbox item's</i> flexbox.  The alignments are defined as:</p>
   756 	<dl>
   757 		<dt><dfn id="flex-align-start">start</dfn></dt>
   758 		<dd>The <i>cross-start</i> margin edge of the <i>flexbox item</i> is placed flush with the <i>cross-start</i> edge of the line.</dd>
   760 		<dt><dfn id="flex-align-end">end</dfn></dt>
   761 		<dd>The <i>cross-end</i> margin edge of the <i>flexbox item</i> is placed flush with the <i>cross-end</i> edge of the line.</dd>
   763 		<dt><dfn id="flex-align-center">center</dfn></dt>
   764 		<dd>The <i>flexbox item's</i> margin box is centered in the <i>cross axis</i> within the line.  (If the <i>cross size</i> of the flexbox is less than that of the <i>flexbox item</i>, it will overflow equally in both directions.)</dd>
   766 		<dt><dfn id="flex-align-baseline">baseline</dfn></dt>
   767 		<dd>
   768 			<p>If the <i>flexbox item's</i> inline axis is the same as the <i>cross axis</i>, this value is identical to ''start''.</p>
   770 			<p>Otherwise, all <i>flexbox items</i> on the line with an alignment of ''baseline'' that don't run afoul of the previous paragraph are aligned such that their baselines align, and the item with the largest distance between its baseline and its <i>cross-start</i> margin edge is placed flush against the <i>cross-start</i> edge of the line.</p>
   771 		</dd>
   773 		<dt><dfn id="flex-align-stretch">stretch</dfn></dt>
   774 		<dd>
   775 			<p>If the <i>cross size property</i> of the <i>flexbox item</i> is ''auto'', it resolves to the length necessary to make the <i>cross size</i> of the item's margin box the same size as the line, while still respecting 'min/max-width/height' constraints as normal.</p>
   777 			<p>The <i>cross-start</i> margin edge of the <i>flexbox item</i> is placed flush with the <i>cross-start</i> edge of the line.</p>
   778 		</dd>
   779 	</dl>
   781 	<div class='figure'>
   782 		<img src="images/flex-align.svg" width=508 height=377>
   783 		<p class='caption'>An illustration of the five 'flex-align' keywords and their effects on a flexbox with four colored items.</p>
   784 	</div>
   786 	<div class=example>   
   787 		<p>By using a vertical flexbox and 'flex-align', we can achieve behavior very close to HTML's <code>&lt;center></code> element:</p>
   789 		<div class='code-and-figure'>
   790 			<div><pre>
   791 &lt;div>
   792   &lt;p>foo foo foo foo&lt;/p>
   793   &lt;p>bar bar&lt;br>bar bar&lt;/p>
   794   &lt;p>foo foo foo foo foo foo foo
   795      foo foo foo foo foo&lt;/p>
   796 &lt;/div>
   797 &lt;style>
   798   div {
   799     display: flexbox;
   800     flex-flow: column;
   801     flex-align: center;
   802     width: 200px;
   803   }
   804 &lt;/style></pre></div>
   805 			<div><p><img alt="" src="images/basic-vertical-flexbox.png"></p></div>
   806 		</div>
   807 	</div>
   810 <h3 id='auto-margins'>
   811 Resolving &#39;auto&#39; margins</h3>
   812 <p>
   813 Margins on flexbox items can be set to &#39;auto&#39;, with effect very similar to auto 
   814 margins in normal flow. </p>
   815 <ul>
   816 	<li>Through calculations of preferred sizes and flexible lengths, auto 
   817 	margins are considered to be zero.</li>
   818 	<li>&nbsp;Immediately <em>before</em> pack and align steps, if there are any 
   819 	auto margins on items in the direction of alignment and there is positive 
   820 	free space, the free space is distributed equally to the auto margins. </li>
   821 	<li>If free space was distributed to auto margins, the following pack or align 
   822 	step has no effect.</li>
   823 </ul>
   824 <div class="example">
   825 <p>Auto margins can be used for simple alignment or for fine control.</p>
   826 	<p>Note that auto margins work consistently in both dimensions, so a simple 
   827 	markup like this</p>
   828 	<pre>div { 	display:flexbox;
   829 	width:4em; height:4em; background:silver;
   830 }
   831 p { margin:auto; }
   832 &lt;div&gt;&lt;p&gt;OK&lt;/p&gt;&lt;/div&gt;</pre>
   833 	<p>will center the single child:
   834 	<img alt="image of square OK button" height="82" src="images/OK.png" width="82"></p>
   835 	<p>And this</p>
   837 <pre>div {	display:flexbox;
   838 	width:calc(100% - 4em); height:calc(100% - 4em);
   839 	border: 1em solid blue; border-radius:50%;
   840 	margin:auto;
   841 }
   842 div#demo { width:9em; height:9em; }</pre>
   843 <pre>&lt;div id=&quot;demo&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</pre>
   844 <p>will produce nested centered boxes:
   845 <img alt="concentric blue circles" height="191" src="images/target.png" width="210"></p>
   846 </div>
   848 <h3 id='flex-line-pack'>
   849 'flex-line-pack' property</h3>
   851 	<table class=propdef>
   852 		<tr>
   853 			<th>Name:
   854 			<td><dfn>flex-line-pack</dfn>
   855 		<tr>
   856 			<th><a href="http://dev.w3.org/csswg/css-module/#values">Value</a>:
   857 			<td>start | end | center | justify | distribute | stretch
   858 		<tr>
   859 			<th>Initial:
   860 			<td>stretch
   861 		<tr>
   862 			<th>Applies to:
   863 			<td><i>multi-line</i> flexboxes
   864 		<tr>
   865 			<th>Inherited:
   866 			<td>no
   867 		<tr>
   868 			<th>Computed Value:
   869 			<td>specified value
   870 		<tr>
   871 			<th>Media:
   872 			<td>visual
   873 		<tr>
   874 			<th>Animatable:
   875 			<td>no
   876 	</table>
   878 	<p>The 'flex-line-pack' property aligns a flexbox's lines within the flexbox when there is extra space in the <i>cross axis</i>, similar to how 'flex-pack' aligns individual items within the <i>main axis</i>:</p>
   880 	<dl>
   881 		<dt><dfn id='flex-line-pack-start'>start</dfn></dt>
   882 		<dd>Lines are packed toward the start of the flexbox.  The <i>cross-start</i> edge of the first line in the flexbox is placed flush with the <i>cross-start</i> edge of the flexbox, and each subsequent line is placed flush with the preceding line.</dd>
   884 		<dt><dfn id='flex-line-pack-end'>end</dfn></dt>
   885 		<dd>Lines are packed toward the end of the flexbox.  The <i>cross-end</i> edge of the last line is placed flush with the <i>cross-end</i> edge of the flexbox, and each preceding line is placed flush with the subsequent line.</dd>
   887 		<dt><dfn id='flex-line-pack-center'>center</dfn></dt>
   888 		<dd>Lines are packed toward the center of the flexbox.  The lines in the flexbox are placed flush with each other and aligned in the center of the flexbox, with equal amounts of empty space between the <i>cross-start</i> content edge of the flexbox and the first line in the flexbox and between the <i>cross-end</i> content edge of the flexbox and the last line in the flexbox.  (If the leftover free-space is negative, the lines will overflow equally in both directions.)</dd>
   890 		<dt><dfn id='flex-line-pack-justify'>justify</dfn></dt>
   891 		<dd>Lines are evenly distributed in the flexbox.  If the leftover free-space is negative or there is only a single line in the flexbox, this value is identical to ''start''.  Otherwise, the <i>cross-start</i> edge of the first line in the flexbox is placed flush with the <i>cross-start</i> content edge of the flexbox, the <i>cross-end</i> edge of the last line in the flexbox is placed flush with the <i>cross-end</i> content edge of the flexbox, and the remaining lines in the flexbox are distributed so that the empty space between any two adjacent lines is the same.</dd>
   893 		<dt><dfn id='flex-line-pack-distribute'>distribute</dfn></dt>
   894 		<dd>Lines are evenly distributed in the flexbox, with half-size spaces on either end.  If the leftover free-space is negative or there is only a single line in the flexbox, this value is identical to ''center''.  Otherwise, the lines in the flexbox are distributed such that the empty space between any two adjacent lines is the same, and the empty space before the first and after the last lines in the flexbox are half the size of the other empty spaces.</dd>
   896 		<dt><dfn id='flex-line-pack-stretch'>stretch</dfn></dt>
   897 		<dd>Lines stretch to take up the remaining space.  If the leftover free-space is negative, this value is identical to ''start''.  Otherwise, the free-space is split equally between all of the lines, increasing their cross size.
   898 	</dl>
   900 	<p class='note'>Note: Only <i>multi-line</i> flexboxes ever have free space in the <i>cross axis</i> for lines to be aligned in, because in a <i>single-line</i> flexbox the sole line automatically stretches to fill the space.</p>
   902 	<p class="issue">TODO: examples</p>
   905 <h2 id='layout-algorithm'>
   906 Flexbox Layout Algorithm</h2>
   908 	<p>This section contains normative algorithms detailing the exact layout behavior of a flexbox and its contents.  The algorithms here were designed to optimize readability and theoretical simplicity, and may not necessarily be the most efficient.  Implementations may use whatever actual algorithms they wish, but must produce the same results as the algorithms described here.</p>
   910 	<div class=note>
   911 		<p>This note will outline the general structure of the layout algorithm, before I go into the ugly details below, to aid in reading the relatively-long and complex algorithm.</p>
   913 		<ol>
   914 			<li value=0>Generate anonymous flexbox items as necessary.</li>
   916 			<li>Reorder flexbox items according to 'flex-order'.</li>
   918 			<li>Find the hypothetical main size of every flexbox item.</li>
   920 			<li>Linebreak the flexbox, if it's multi-line.</li>
   922 			<li>Based on the hypothetical sizes of the items, find the real main size of the flexbox.</li>
   924 			<li>Resolve any flexible lengths.  All items now have a real main size.</li>
   926 			<li>Update layout for the items based on their real main sizes, and determine their hypothetical cross size.</li>
   928 			<li>Find the real cross size of the flexbox and its lines.</li>
   930 			<li>Align the lines, per 'flex-line-pack'.</li>
   932 			<li>Align in the cross axis, per 'flex-align'.</li>
   934 			<li>Update layout for the items based on their real cross sizes.</li>
   936 			<li>Align in the main axis, per 'flex-pack'.</li>
   937 		</ol>
   938 	</div>
   940 	<p>This section is mainly intended for implementors.  Authors writing web pages should generally be served well by the individual property descriptions, and do not need to read this section unless they have a deep-seated urge to understand arcane details of CSS layout.</p>
   942 	<p>To lay out a flexbox and its contents, follow these steps:</p>
   944 	<ol>
   945 		<li value=0>Generate anonymous flexbox items around runs of contiguous inline content in the flexbox, as described in the <a href="#flex-items">Flexbox Items</a> section.</li>
   947 		<li>Re-order the flexbox items according to their 'flex-order'.  The items with the lowest (most negative) 'flex-order' values are first in the ordering.  If multiple items share a 'flex-order' value, they're ordered by document order.  This affects the order in which the flexbox items generate boxes in the box-tree, and how the rest of this algorithm deals with the items.</li>
   949 		<li>
   950 			Determine the hypothetical main size of items:
   952 			<ol>
   953 				<li>If item has a definite preferred size, it is the hypothetical main size. </li>
   955 				<li>
   956 					<p>Otherwise layout the flexbox items using the shrink-to-fit algorithm.</p>
   958 					<p>Calculation of the shrink-to-fit width is similar to calculating the width of a table cell using the automatic table layout algorithm. Roughly: calculate the preferred width by formatting the content without breaking lines other than where explicit line breaks occur, and also calculate the preferred minimum width, e.g., by trying all possible line breaks. This module doesn&#39;t define the exact algorithm, but it is expected that the shrink-to-fit size is calculated the same way as it is for floats, except in this case it is not affected by available space.</p>
   960 					<div class="issue"><p>TODO: define shrink-to-fit. It works 
   961 						differently in row/column flexboxes:</p>
   962 						<ul>
   963 							<li>In horizontal, STF is max-content. </li>
   964 							<li>In vertical, cross-axis 
   965 					alignment has to happen first, then main-axis STF size can 
   966 					be calculated. In multi-line vertical (tricky case), auto 
   967 							sizes on cross axis are resolved as if it was 
   968 							single-line.</li>
   969 						</ul>
   970 					</div>
   971 				</li>
   972 			</ol>
   974 			<p><em>Do not apply min/max-width/height constraints to the preferred size of flexible lengths - those constraints are handled elsewhere in this algorithm, and doing so will produce incorrect results. </em></p>
   975 		</li>
   977 		<li>
   978 			<p>If the flexbox is single-line, collect all the flexbox items into a single flexbox line.</p>
   979 		</li>
   981 		<li>
   982 			<p>If the flexbox is multi-line, group the flexbox items into multiple lines:</p>
   984 			<ol>
   985 				<li>
   986 					<p>Determine the maximum line length, based on the main size of the flexbox. The maximum line length is main size of the flexbox's content box, constrained by the min and max main size constraints of the flexbox.  If the main size depends on the flexbox's content, then:</p>
   988 					<ul>
   989 						<li>for ''min-content'', the maximum line length is the flexbox's minimum main size, constrained by the min and max main size constraints of the flexbox.</li>
   991 						<li>for ''max-content'', the maximum line length is infinity, constrained by the min and max main size constraints of the flexbox.</li>
   993 						<li>for ''fit-content'', the maximum line length is the greater of the flexbox's min size constraint and the smaller of the flexbox's max size constraint and the available space.</li>
   994 					</ul>
   995 				</li>
   997 				<li>Collect as many consecutive flexbox items as possible, starting from the first item, while keeping the sum of their main size smaller than the flexbox's available space.  If a flexbox item is sized with a flexible length, then for the purpose of this step, clamp the item's size between its minimum and maximum main sizes.  The items so collected form a single flexbox line.</li>
   999 				<li>Repeat the previous step, starting each time from the first flexbox item not yet collected into a flexbox line, until all flexbox items have been collected into flexbox lines.</li>
  1000 			</ol>
  1001 		</li>
  1003 		<li>Find the actual main size of the flexbox.  If the flexbox's main size doesn't rely on its contents, its actual main size is calculated per the appropriate rules.  Otherwise, its main size is the length of its longest line, calculated by summing the main sizes of the margin boxes of each flexbox item in the line, constrained by the flexbox's min and max main size constraints. 
  1004 		If any margins are set to &#39;auto&#39;, consider them to be set to zero until 
  1005 		resolved in a separate step.</li>
  1007 		<li>For each flexbox line, 
  1008 		<ol>
  1009 			<li><i>Resolve the flexible lengths</i> of the items contained within it.  All flexbox items now have a final main size.  Update each item's hypothetical cross size based on this main size.</li>
  1011 			<li>Calculate the leftover free-space by subtracting the sum of the 
  1012 			margin-box main sizes of the items on the line from the main size of the flexbox's content box.</li>
  1013 			<li>Resolve &#39;auto&#39; margins on main axis:<ol>
  1014 				<li>If leftover free-space is positive and any items on this 
  1015 				line have at least one main-axis margin set to &#39;auto&#39;, 
  1016 				distribute the leftover free-space equally to these margins.</li>
  1017 				<li>If leftover free-space is negative, any main-axis &#39;auto&#39; 
  1018 				margins on items in this line are set to zero.</li>
  1019 			</ol>
  1020 			</li>
  1021 			<li>
  1022 			Align the items along the main axis per 'flex-pack'.
  1023 			</li>
  1024 		</ol>
  1025 		</li>
  1027 		<li>Calculate the cross size of each flexbox line. For each flexbox 
  1028 		line:
  1029 			<ol>
  1030 				<li>If the flexbox is single-line and has a definite cross size, the single flexbox line's cross size is the cross size of the flexbox's content box.  End this step of the algorithm.</li>
  1032 				<li>If main axis is parallel to inline axis, collect all the flexbox items with a 'flex-item-align' of 'baseline'. Find the maximum of the distances from their baseline to the cross-start edge of their margin box, and the maximum of the distances from their baseline to the cross-end edge of their margin box. Sum these two values.</li>
  1034 				<li>For remaining flexbox items, find the maximum of the cross sizes of their margin boxes.
  1036 				<li>The cross size of the flexbox line is the larger of the numbers found in the previous two steps.</li>
  1037 				<li>If the flexbox is multi-line, has a definite cross size, 
  1038 				&#39;flex-line-pack&#39; is set to &#39;stretch&#39; and sum of cross size of 
  1039 				all lines is less than cross size of content box, increase cross 
  1040 				size of each line by equal amount to exactly match the cross 
  1041 				size of content box.</li>
  1042 			</ol>
  1043 		</li>
  1045 		<li>If the flexbox doesn't have a definite cross size, the cross size of its content box is the sum of the cross sizes of all of its lines.</li>
  1047 		<li>Determine the final cross size of each flexbox item.  For each flexbox item, if it has ''flex-item-align:stretch'', its final cross size is 
  1048 		set so that its margin-box cross size is equal to cross-size of its flexbox line.  For all other flexbox items, its final cross size is its hypothetical cross size. 
  1049 		If the result conflicts with &#39;min-width&#39;, &#39;max-width&#39;, &#39;min-height&#39; or 
  1050 		&#39;max-height&#39;, correct the result to comply the restrictions.</li>
  1051 		<p class="issue">'auto' height must only grow, not shrink here</p>
  1053 		<li>Resolve &#39;auto&#39; margins on cross axis. For each flexbox item, if its 
  1054 		margin box cross size is smaller than cross size of its line and it has 
  1055 		any margins in cross direction set to &#39;auto&#39;, distribute the difference 
  1056 		equally to the auto margins. </li>
  1057 		<li>For each flexbox line, align the flexbox items per 'flex-item-align'.</li>
  1059 		<li>Align the flexbox lines per 'flex-line-pack'.  The leftover free-space is calculated by subtracting the sum of the flexbox line's cross sizes from the cross size of the flexbox's content box.</li>
  1060 		<li>Layout all items again in their final size and position. 
  1061 		Implementations can determine when this step is needed and how it can be 
  1062 		optimized, but for precise results it has to be assumed that this step 
  1063 		is performed, because the layout of each item&#39;s content may change when 
  1064 		ea</li>
  1065 	</ol>
  1067 	<p>To <dfn>resolve the flexible lengths</dfn> of the items within a flexbox line:</p>
  1069 	<ol>
  1070 		<li>
  1071 			Determine sign of flexibility
  1073 			<ol>
  1074 				<li>Add sizes of all items, <i>adjusted for min/max</i>.
  1076 				<li>If sum of preferred sizes is less than available space, use positive flexibility, otherwise use negative flexibility.</li>
  1077 			</ol>
  1079 			<p>for the rest of the algorithm use flexibility with the sign determined in this step</p>
  1080 		</li>
  1082 		<li>Reset all flexible sizes to their preferred size</li>
  1084 		<li>Find free space by subtracting sum of item sizes from available space.</li>
  1086 		<li>
  1087 			Distribute free space proportional to flex:
  1089 			<ol>
  1090 				<li>If the free space is positive, but step 1 chose negative flexibility, do nothing</li>
  1092 				<li>If the free space is negative, but step 1 chose positive flexibility, do nothing</li>
  1094 				<li>Add a portion of free space to each flexible item, 
  1095 				proportional to item's flexibility</li>
  1096 			</ol>
  1097 		</li>
  1099 		<li>
  1100 			Fix min/max violations:
  1102 			<ol>
  1103 				<li>Adjust each flexible item for min/max. </li>
  1105 				<li>If the size has changed, it is a violation. </li>
  1107 				<li>The violation may be positive (min violation) or negative (max violation). Accumulate the difference.</li>
  1108 			</ol>
  1109 		</li>
  1111 		<li>
  1112 			If the sum of all violations is:
  1114 			<dl>
  1115 				<dt>Zero</dt>
  1116 				<dd>Exit the algorithm.</dd>
  1118 				<dt>Positive</dt>
  1119 				<dd>Freeze items with max violations, and return to step 2.</dd>
  1121 				<dt>Negative</dt>
  1122 				<dd>Freeze items with min violations, and return to step 2.</dd>
  1123 			</dl>
  1124 		</li>
  1125 	</ol>
  1127 <h2 id="pagination">
  1128 Page breaks in flexbox</h2>
  1130 	<p>Flexboxes can break across pages between items, between lines of items (in multi-line mode) and inside items, as long as 'break-' property allow that. All 'break-' properties are supported on flexbox, on flexbox items and inside flexbox items.</p>
  1132 	<p>The following breaking rules refer to fragmentation container as “page”. The same rules apply to any other fragmenters. Change “page” to the appropriate fragmenter type as needed.</p>
  1134 	<p>Breaks in and around flexbox are determined as follows:</p>
  1136 	<ol>
  1137 		<li> Break-before, break-after, break-inside properties on flexbox itself have effect as normal. If breaks inside flexbox are allowed, break points are determined using following rules.</li>
  1139 		<li>When flexbox is continued after a break, flexbox’s available space in block direction is reduced by space consumed in previous pages. Consumed space before page break is:
  1141 			<ol>
  1142 				<li>If flexbox starts on that page: the distance between start of content box of the flexbox and the end of available space</li>
  1144 				<li>If flexbox continues from previous page: the size of available space.</li>
  1145 			</ol>
  1147 			<p>If as a result of this adjustment block-direction size of flexbox becomes negative, it is set to zero.</p>
  1148 		</li>
  1150 		<li>
  1151 			<dfn>Forced breaks on flexbox items</dfn>
  1153 			<ol>
  1154 				<li>In a row-direction single-line flexbox, breaks before and after items apply to the flexbox</li>
  1155 				<p class="issue">"break-inside:avoid" in single-line horizontal should probably be applied to flexbox too.</p>
  1157 				<li>In column-direction single-line flexbox and all multi-line flexboxes:
  1159 					<ol>
  1160 						<li>Forced break before the first item is applied to the flexbox</li>
  1162 						<li>Forced break after the last item is applied to the flexbox</li>
  1164 						<li>Forced break before or after any other item terminates the set of items to be laid out on this page</li>
  1165 					</ol>
  1166 				</li>
  1167 			</ol>
  1169 		</li>
  1171 		<li>When necessary, a <dfn>break inside a flexbox item is considered</dfn> as follows:
  1173 			<ol>
  1174 				<li>If the item has “break-inside:avoid”, it is pushed to the next page</li>
  1176 				<li>Otherwise, it may be broken, according to breaking rules and algorithms applicable to its display type. </li>
  1178 				<li>Forced breaks inside flex item content are handled normally, but in row-direction flexbox they don&#39;t affect layout of sibling flex items (e.g. a forced break inside an item doesn&#39;t prevent its next sibling from appearing on the same page)</li>
  1179 			</ol>
  1180 		</li>
  1182 		<li>
  1183 			<b>Column-direction flexbox: single-line</b>
  1185 			<ol>
  1186 				<li>
  1187 					<p>If flexbox main-axis size is definite, flexbox algorithm must be run first, without constraints of available space on page and using all content of the flexbox. Otherwise items use the preferred size, adjusted for min/max.</p>
  1189 					<p>If page size varies and flexbox size depends on page size, this step has to be repeated on each page, again with the whole content of the flexbox.</p>
  1190 				</li>
  1192 				<li>Set of items that will fit on current page is determined by adding main-axis sizes of items until total size exceeds 
  1193 				available space or a forced break is encountered.</li>
  1195 				<li>If border box of an item doesn’t fit in available space, a break inside the item is considered</li>
  1197 				<li>
  1198 					<p>Items that fit on a page completely or partially are aligned according to ‘flex-pack’ property, independently from the rest of flexbox content.</p>
  1200 					<p>Note that flexible lengths are not recalculated on each page, even if there is additional free space.</p>
  1201 				</li>
  1202 			</ol>
  1204 			<p class="note">It is the intent of this spec that column-direction single-line flexbox paginates very 
  1205 			similarly to block flow. As a test of the intent, a flexbox with "flex-pack:start" and no flexible items should paginate identically to a block with non-floating children with same content, same used size and same used margins. This rule is simplified and not normative, but if there is any difference it should be noted here.</p>
  1206 		</li>
  1208 		<li>
  1209 			<b>Column-direction flexbox: multi-line</b>
  1211 			<ol>
  1212 				<li>Items are collected in lines and laid out as usual, but in available space on current page.</li>
  1214 				<li>If border box of an item doesn’t fit on main-axis and it is 
  1215 				the only item in its line:
  1216 					<ol>
  1217 						<li>If the flexbox is not at the top of the page, it is moved to the next page.</li>
  1219 						<li>If the flexbox is already at the top of the page, the item may produce overflow. If 'overflow' property of the flexbox is set to 'visible', it is paginated using same rules as visible overflow of blocks in normal flow.
  1221 							<p class="note">After the break, continuation of overflow items may overlap with other items and/or content after the flexbox. It is undesirable but there is no good resolution for this spacial conflict and this outcome is similar to effect of "overflow:visible" elsewhere.</p>
  1222 						</li>
  1223 							</ol>
  1224 						</li>
  1225 					</ol>
  1226 				</li>
  1227 				<li>Breaks inside items (forced or unforced) are not allowed</li>
  1228 			</ol>
  1229 		</li>
  1231 		<li>
  1232 			<b>Row-direction flexbox: single-line</b>
  1234 			<ol>
  1235 				<li>
  1236 					<p>Main-axis space distribution in each line is done based on complete content of the flexbox and without space constraint in block direction.</p>
  1238 					<p>If page size varies and flexbox size depends on page size, this step needs to be repeated on each page.</p>
  1239 				</li>
  1241 				<li>Items are sized and positioned as usual, but in block-direction available space of min(remaining available space in flexbox, remaining space on the page).</li>
  1243 				<li>Any items with baseline alignment must be aligned before considering breaks inside items.</li>
  1245 				<li>If border box of an item doesn’t fit in current page, a break inside the item is considered</li>
  1247 				<li>Items that have fit completely on a previous page and items that are pushed to next page don’t have any rendering, leaving empty space as needed.</li>
  1249 				<li>Items that fit completely or partially on current page are aligned on cross-axis:
  1251 					<ol>
  1252 						<li>For the purposes of cross-axis alignment, minimum of remaining available space in flexbox and available space at current page is used.</li>
  1254 						<li>If an item is broken in the previous step and its alignment is not baseline, its cross-axis size is set to available space. If item alignment is baseline, its cross-axis size is adjusted so that it extends to exactly the end of available space.</li>
  1255 					</ol>
  1256 				</li>
  1257 			</ol>
  1258 		</li>
  1260 		<li>
  1261 			<b>Row-direction flexbox:multi-line</b>
  1263 			<ol>
  1264 				<li>Collect items into lines and determine line heights:
  1266 					<ol>
  1267 						<li>
  1268 							<p>If 'flex-line-pack' is 'stretch' and flexbox size in block direction is definite, layout of the complete flexbox has to be done first to determine line heights. Layout is done as usual for non-paginated case, but accounting for forced breaks.</p>
  1270 							<p>If page size varies, this step may have to be redone, again with complete content; special consideration should be to be given to line breaks to ensure that item at the start of current page is also at the start of a line in this hypothetical layout. This specification currently doesn't define how exactly to achieve that.</p>
  1271 						</li>
  1273 						<li>Otherwise, items are collected into lines and each line is laid out as a single-line flexbox to determine block-direction size of each line.</li>
  1274 					</ol>
  1275 				</li>	
  1277 				<li>Lines are added one at a time, until out of available space or a forced break is encountered</li>
  1279 				<li>Breaks inside items (forced or unforced) are not allowed.</li>
  1280 				<li>If the first flexbox line on a page doesn&#39;t fit in 
  1281 				cross-axis,
  1282 				<ol>
  1283 					<li>If the flexbox is not at the top of the page, it is moved to the next page.</li>
  1284 					<li>If the flexbox is already at the top of the page, the item may produce overflow. If 'overflow' property of the flexbox is set to 'visible', it is paginated using same rules as visible overflow of blocks in normal flow.</li>
  1285 				</ol>
  1286 				</li>
  1288 				<li>If size of flexbox in inline direction is not definite, multi-line layout algorithm is run using the set of items 
  1289 				that have fit on the current page.</li>
  1291 				<li>Line packing is done on each page, with content on the page</li>
  1292 				<p class="issue">TODO: combine breaking algorithms for multiline in both directions. If breaks inside items are not allowed the algorithm is almost same.</p>
  1293 			</ol>
  1294 		</li>
  1295 	</ol>
  1297 <h2 id="conformance">
  1298 Conformance</h2>
  1300 <h3 id="conventions">
  1301 Document conventions</h3>
  1303   <p>Conformance requirements are expressed with a combination of
  1304   descriptive assertions and RFC 2119 terminology. The key words “MUST”,
  1305   “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
  1306   “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
  1307   document are to be interpreted as described in RFC 2119.
  1308   However, for readability, these words do not appear in all uppercase
  1309   letters in this specification.
  1311   <p>All of the text of this specification is normative except sections
  1312   explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
  1314   <p>Examples in this specification are introduced with the words “for example”
  1315   or are set apart from the normative text with <code>class="example"</code>,
  1316   like this:
  1318   <div class="example">
  1319     <p>This is an example of an informative example.</p>
  1320   </div>
  1322   <p>Informative notes begin with the word “Note” and are set apart from the
  1323   normative text with <code>class="note"</code>, like this:
  1325   <p class="note">Note, this is an informative note.</p>
  1327 <h3 id="conformance-classes">
  1328 Conformance classes</h3>
  1330   <p>Conformance to CSS Flexbox Layout Module
  1331   is defined for three conformance classes:
  1332   <dl>
  1333     <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
  1334       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
  1335       style sheet</a>.
  1336     <dt><dfn>renderer</dfn></dt>
  1337       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1338       that interprets the semantics of a style sheet and renders
  1339       documents that use them.
  1340     <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
  1341       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1342       that writes a style sheet.
  1343   </dl>
  1345   <p>A style sheet is conformant to CSS Flexbox Layout Module
  1346   if all of its statements that use syntax defined in this module are valid
  1347   according to the generic CSS grammar and the individual grammars of each
  1348   feature defined in this module.
  1350   <p>A renderer is conformant to CSS Flexbox Layout Module
  1351   if, in addition to interpreting the style sheet as defined by the
  1352   appropriate specifications, it supports all the features defined
  1353   by CSS Flexbox Layout Module by parsing them correctly
  1354   and rendering the document accordingly. However, the inability of a
  1355   UA to correctly render a document due to limitations of the device
  1356   does not make the UA non-conformant. (For example, a UA is not
  1357   required to render color on a monochrome monitor.)
  1359   <p>An authoring tool is conformant to CSS Flexbox Layout Module
  1360   if it writes style sheets that are syntactically correct according to the
  1361   generic CSS grammar and the individual grammars of each feature in
  1362   this module, and meet all other conformance requirements of style sheets
  1363   as described in this module.
  1365 <h3 id="partial">
  1366 Partial implementations</h3>
  1368   <p>So that authors can exploit the forward-compatible parsing rules to
  1369   assign fallback values, CSS renderers <strong>must</strong>
  1370   treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
  1371   as appropriate</a>) any at-rules, properties, property values, keywords,
  1372   and other syntactic constructs for which they have no usable level of
  1373   support. In particular, user agents <strong>must not</strong> selectively
  1374   ignore unsupported component values and honor supported values in a single
  1375   multi-value property declaration: if any value is considered invalid
  1376   (as unsupported values must be), CSS requires that the entire declaration
  1377   be ignored.</p>
  1379 <h3 id="experimental">
  1380 Experimental implementations</h3>
  1382   <p>To avoid clashes with future CSS features, the CSS2.1 specification
  1383   reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
  1384   syntax</a> for proprietary and experimental extensions to CSS.
  1386   <p>Prior to a specification reaching the Candidate Recommendation stage
  1387   in the W3C process, all implementations of a CSS feature are considered
  1388   experimental. The CSS Working Group recommends that implementations
  1389   use a vendor-prefixed syntax for such features, including those in
  1390   W3C Working Drafts. This avoids incompatibilities with future changes
  1391   in the draft.
  1392   </p>
  1394 <h3 id="testing">
  1395 Non-experimental implementations</h3>
  1397   <p>Once a specification reaches the Candidate Recommendation stage,
  1398   non-experimental implementations are possible, and implementers should
  1399   release an unprefixed implementation of any CR-level feature they
  1400   can demonstrate to be correctly implemented according to spec.
  1402   <p>To establish and maintain the interoperability of CSS across
  1403   implementations, the CSS Working Group requests that non-experimental
  1404   CSS renderers submit an implementation report (and, if necessary, the
  1405   testcases used for that implementation report) to the W3C before
  1406   releasing an unprefixed implementation of any CSS features. Testcases
  1407   submitted to W3C are subject to review and correction by the CSS
  1408   Working Group.
  1410   <p>Further information on submitting testcases and implementation reports
  1411   can be found from on the CSS Working Group's website at
  1412   <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
  1413   Questions should be directed to the
  1414   <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
  1415   mailing list.
  1417 <h3 id="cr-exit-criteria">
  1418 CR exit criteria</h3>
  1420   <p>
  1421   For this specification to be advanced to Proposed Recommendation,
  1422   there must be at least two independent, interoperable implementations
  1423   of each feature. Each feature may be implemented by a different set of
  1424   products, there is no requirement that all features be implemented by
  1425   a single product. For the purposes of this criterion, we define the
  1426   following terms:
  1428   <dl>
  1429     <dt>independent <dd>each implementation must be developed by a
  1430     different party and cannot share, reuse, or derive from code
  1431     used by another qualifying implementation. Sections of code that
  1432     have no bearing on the implementation of this specification are
  1433     exempt from this requirement.
  1435     <dt>interoperable <dd>passing the respective test case(s) in the
  1436     official CSS test suite, or, if the implementation is not a Web
  1437     browser, an equivalent test. Every relevant test in the test
  1438     suite should have an equivalent test created if such a user
  1439     agent (UA) is to be used to claim interoperability. In addition
  1440     if such a UA is to be used to claim interoperability, then there
  1441     must one or more additional UAs which can also pass those
  1442     equivalent tests in the same way for the purpose of
  1443     interoperability. The equivalent tests must be made publicly
  1444     available for the purposes of peer review.
  1446     <dt>implementation <dd>a user agent which:
  1448     <ol class=inline>
  1449       <li>implements the specification.
  1451       <li>is available to the general public. The implementation may
  1452       be a shipping product or other publicly available version
  1453       (i.e., beta version, preview release, or “nightly build”). 
  1454       Non-shipping product releases must have implemented the
  1455       feature(s) for a period of at least one month in order to
  1456       demonstrate stability.
  1458       <li>is not experimental (i.e., a version specifically designed
  1459       to pass the test suite and is not intended for normal usage
  1460       going forward).
  1461     </ol>
  1462   </dl>
  1464   <p>The specification will remain Candidate Recommendation for at least
  1465   six months.
  1468 <hr title="Separator from footer">
  1470 <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
  1472 	<p>[This section will contain further acknowledgments.]</p>
  1474 	<p>Thanks for feedback from James Elmore and Shinichiro Hamaji.</p>
  1476 <h2 class="no-num" id="references">References</h2>
  1478 <h3 class="no-num" id="normative">Normative references</h3>
  1479 <!--normative-->
  1481 <h3 class="no-num" id="informative">Other references</h3>
  1482 <!--informative-->
  1484 <h2 id="property" class="no-num">Property index</h2>
  1485 <!--properties-->
  1487 <h2 class="no-num" id="index">Index</h2>
  1488 <!--index-->
  1490 </body></html>
  1491 <!-- Keep this comment at the end of the file
  1492 Local variables:
  1493 mode: sgml
  1494 sgml-declaration:"~/SGML/HTML4.decl"
  1495 sgml-default-doctype-name:"html"
  1496 sgml-minimize-attributes:t
  1497 sgml-nofill-elements:("pre" "style" "br")
  1498 sgml-live-element-indicator:t
  1499 sgml-omittag:nil
  1500 sgml-shorttag:nil
  1501 sgml-namecase-general:t
  1502 sgml-general-insert-case:lower
  1503 sgml-always-quote-attributes:t
  1504 sgml-indent-step:nil
  1505 sgml-indent-data:t
  1506 sgml-parent-document:nil
  1507 sgml-exposed-tags:nil
  1508 sgml-local-catalogs:nil
  1509 sgml-local-ecat-files:nil
  1510 End:
  1511 -->

mercurial