Skip to content

Commit 11bc8d3

Browse files
committed
editorial
--HG-- extra : rebase_source : 741b0249f82f301637a5a0688475c59459fd8e64
1 parent 8300052 commit 11bc8d3

2 files changed

Lines changed: 155 additions & 143 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 90 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,17 @@ <h2 class="no-num no-toc" id=table>Table of contents</h2>
231231

232232
<li><a href="#alignment"><span class=secno>8. </span> Alignment</a>
233233
<ul class=toc>
234-
<li><a href="#flex-pack"><span class=secno>8.1. </span> Axis Alignment:
234+
<li><a href="#auto-margins"><span class=secno>8.1. </span> Aligning with
235+
&lsquo;<code class=css>auto</code>&rsquo; margins</a>
236+
237+
<li><a href="#flex-pack"><span class=secno>8.2. </span> Axis Alignment:
235238
the &lsquo;<code class=property>flex-pack</code>&rsquo; property</a>
236239

237-
<li><a href="#flex-align"><span class=secno>8.2. </span> Cross-axis
240+
<li><a href="#flex-align"><span class=secno>8.3. </span> Cross-axis
238241
Alignment: the &lsquo;<code class=property>flex-align</code>&rsquo; and
239242
&lsquo;<code class=property>flex-item-align</code>&rsquo;
240243
properties</a>
241244

242-
<li><a href="#auto-margins"><span class=secno>8.3. </span> Resolving
243-
&lsquo;<code class=css>auto</code>&rsquo; margins</a>
244-
245245
<li><a href="#flex-line-pack"><span class=secno>8.4. </span>
246246
&lsquo;<code class=property>flex-line-pack</code>&rsquo; property</a>
247247
</ul>
@@ -1392,8 +1392,8 @@ <h2 id=flexibility><span class=secno>7. </span> Flexibility: the &lsquo;<a
13921392
<h2 id=alignment><span class=secno>8. </span> Alignment</h2>
13931393

13941394
<p> After a flexbox's contents have finished their flexing and the
1395-
dimensions of margin boxes of all flexbox items are finalized, they can be
1396-
aligned along the <a href="#main-axis"><i>main axis</i></a> with &lsquo;<a
1395+
dimensions of all flexbox items are finalized, they can be aligned along
1396+
the <a href="#main-axis"><i>main axis</i></a> with &lsquo;<a
13971397
href="#flex-pack0"><code class=property>flex-pack</code></a>&rsquo; and
13981398
the <a href="#cross-axis"><i>cross axis</i></a> with &lsquo;<a
13991399
href="#flex-align0"><code class=property>flex-align</code></a>&rsquo; and
@@ -1402,7 +1402,62 @@ <h2 id=alignment><span class=secno>8. </span> Alignment</h2>
14021402
many common types of alignment trivial, including some things that were
14031403
very difficult in CSS 2.1, like horizontal and vertical centering.
14041404

1405-
<h3 id=flex-pack><span class=secno>8.1. </span> Axis Alignment: the
1405+
<h3 id=auto-margins><span class=secno>8.1. </span> Aligning with
1406+
&lsquo;<code class=css>auto</code>&rsquo; margins</h3>
1407+
1408+
<p> Margins on flexbox items that are &lsquo;<code
1409+
class=css>auto</code>&rsquo; have an effect very similar to auto margins
1410+
in normal flow:
1411+
1412+
<ul>
1413+
<li> During calculations of preferred sizes and flexible lengths, auto
1414+
margins are treated as &lsquo;<code class=css>0</code>&rsquo;.
1415+
1416+
<li> Prior to alignment via &lsquo;<a href="#flex-pack0"><code
1417+
class=property>flex-pack</code></a>&rsquo; and &lsquo;<a
1418+
href="#flex-item-align"><code
1419+
class=property>flex-item-align</code></a>&rsquo;, any positive free space
1420+
is distributed to auto margins in that dimension.
1421+
1422+
<li> Margin-based alignment has no effect on overflowing elements.
1423+
</ul>
1424+
1425+
<p class=note> Note that, if free space is distributed to auto margins, the
1426+
alignment properties will have no effect in that dimension.
1427+
1428+
<div class=example>
1429+
<p>Auto margins can be used for simple alignment or for fine control.
1430+
1431+
<p>Note that auto margins work consistently in both dimensions, so a
1432+
simple markup like this
1433+
1434+
<pre>
1435+
div { display:flexbox;
1436+
width:4em; height:4em; background:silver;
1437+
}
1438+
p { margin:auto; }
1439+
&lt;div&gt;&lt;p&gt;OK&lt;/p&gt;&lt;/div&gt;</pre>
1440+
1441+
<p>will center the single child: <img alt="image of square OK button"
1442+
height=82 src="images/OK.png" width=82>
1443+
1444+
<p>And this
1445+
1446+
<pre>
1447+
div { display:flexbox;
1448+
width:calc(100% - 4em); height:calc(100% - 4em);
1449+
border: 1em solid blue; border-radius:50%;
1450+
margin:auto;
1451+
}
1452+
div#demo { width:9em; height:9em; }
1453+
1454+
&lt;div id="demo">&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/div></pre>
1455+
1456+
<p> will produce nested centered boxes: <img alt="concentric blue circles"
1457+
height=191 src="images/target.png" width=210>
1458+
</div>
1459+
1460+
<h3 id=flex-pack><span class=secno>8.2. </span> Axis Alignment: the
14061461
&lsquo;<a href="#flex-pack0"><code
14071462
class=property>flex-pack</code></a>&rsquo; property</h3>
14081463

@@ -1461,8 +1516,8 @@ <h3 id=flex-pack><span class=secno>8.1. </span> Axis Alignment: the
14611516
This is done <em title="">after</em> any flexible lengths and any auto
14621517
margins have been resolved. Typically it helps distribute extra free space
14631518
leftover when either all the <a href="#flexbox-item"><i>flexbox
1464-
items</i></a> on a line are inflexible, or are flexible but have reach
1465-
their maximum size, but it also exerts some control over the alignment of
1519+
items</i></a> on a line are inflexible, or are flexible but have reached
1520+
their maximum size. It also exerts some control over the alignment of
14661521
items when they overflow the line.
14671522

14681523
<dl>
@@ -1540,7 +1595,7 @@ <h3 id=flex-pack><span class=secno>8.1. </span> Axis Alignment: the
15401595
keywords and their effects on a flexbox with three colored items.
15411596
</div>
15421597

1543-
<h3 id=flex-align><span class=secno>8.2. </span> Cross-axis Alignment: the
1598+
<h3 id=flex-align><span class=secno>8.3. </span> Cross-axis Alignment: the
15441599
&lsquo;<a href="#flex-align0"><code
15451600
class=property>flex-align</code></a>&rsquo; and &lsquo;<a
15461601
href="#flex-item-align"><code
@@ -1656,11 +1711,11 @@ <h3 id=flex-align><span class=secno>8.2. </span> Cross-axis Alignment: the
16561711
href="#flex-item-align"><code
16571712
class=property>flex-item-align</code></a>&rsquo; allows this default
16581713
alignment to be overridden for individual <a
1659-
href="#flexbox-item"><i>flexbox items</i></a> (for anonymous flexbox
1714+
href="#flexbox-item"><i>flexbox items</i></a>. (For anonymous flexbox
16601715
items, &lsquo;<a href="#flex-item-align"><code
16611716
class=property>flex-item-align</code></a>&rsquo; always matches the value
16621717
of &lsquo;<a href="#flex-align0"><code
1663-
class=property>flex-align</code></a>&rsquo; on their associated flexbox).
1718+
class=property>flex-align</code></a>&rsquo; on their associated flexbox.)
16641719

16651720
<p> A value of <dfn id=flex-item-align-auto>&lsquo;<code
16661721
class=css>auto</code>&rsquo;</dfn> for &lsquo;<a
@@ -1698,15 +1753,14 @@ <h3 id=flex-align><span class=secno>8.2. </span> Cross-axis Alignment: the
16981753
class=css>baseline</code>&rsquo;</dfn>
16991754

17001755
<dd>
1701-
<p> If the <a href="#flexbox-item"><i>flexbox item's</i></a> inline-axis
1702-
is the same as the <i>cross-axis</i>, this value is identical to
1703-
&lsquo;<code class=css>start</code>&rsquo;.
1704-
1705-
<p> Otherwise, all <a href="#flexbox-item"><i>flexbox items</i></a> on
1706-
the line with an alignment of &lsquo;<code
1707-
class=css>baseline</code>&rsquo; that don't run afoul of the previous
1708-
paragraph are aligned such that their baselines align, and the item with
1709-
the largest distance between its baseline and its <a
1756+
<p> If the <a href="#flexbox-item"><i>flexbox item's</i></a> inline axis
1757+
is the same as the <a href="#cross-axis"><i>cross axis</i></a>, this
1758+
value is identical to &lsquo;<code class=css>start</code>&rsquo;.
1759+
1760+
<p> Otherwise, it participates in baseline alignment: all participating
1761+
<a href="#flexbox-item"><i>flexbox items</i></a> on the line are aligned
1762+
such that their baselines align, and the item with the largest distance
1763+
between its baseline and its <a
17101764
href="#cross-start"><i>cross-start</i></a> margin edge is placed flush
17111765
against the <a href="#cross-start"><i>cross-start</i></a> edge of the
17121766
line.
@@ -1765,57 +1819,6 @@ <h3 id=flex-align><span class=secno>8.2. </span> Cross-axis Alignment: the
17651819
</div>
17661820
</div>
17671821

1768-
<h3 id=auto-margins><span class=secno>8.3. </span> Resolving &lsquo;<code
1769-
class=css>auto</code>&rsquo; margins</h3>
1770-
1771-
<p>Margins on flexbox items can be set to &lsquo;<code
1772-
class=css>auto</code>&rsquo;, with effect very similar to auto margins in
1773-
normal flow.
1774-
1775-
<ul>
1776-
<li>Through calculations of preferred sizes and flexible lengths, auto
1777-
margins are considered to be zero.
1778-
1779-
<li>Immediately <em>before</em> pack and align steps, if there are any
1780-
auto margins on items in the direction of alignment and there is positive
1781-
free space, the free space is distributed equally to the auto margins.
1782-
1783-
<li>If free space was distributed to auto margins, the following pack or
1784-
align step has no effect.
1785-
</ul>
1786-
1787-
<div class=example>
1788-
<p>Auto margins can be used for simple alignment or for fine control.
1789-
1790-
<p>Note that auto margins work consistently in both dimensions, so a
1791-
simple markup like this
1792-
1793-
<pre>
1794-
div { display:flexbox;
1795-
width:4em; height:4em; background:silver;
1796-
}
1797-
p { margin:auto; }
1798-
&lt;div&gt;&lt;p&gt;OK&lt;/p&gt;&lt;/div&gt;</pre>
1799-
1800-
<p>will center the single child: <img alt="image of square OK button"
1801-
height=82 src="images/OK.png" width=82>
1802-
1803-
<p>And this
1804-
1805-
<pre>
1806-
div { display:flexbox;
1807-
width:calc(100% - 4em); height:calc(100% - 4em);
1808-
border: 1em solid blue; border-radius:50%;
1809-
margin:auto;
1810-
}
1811-
div#demo { width:9em; height:9em; }
1812-
1813-
&lt;div id="demo">&lt;div>&lt;div>&lt;/div>&lt;/div>&lt;/div></pre>
1814-
1815-
<p> will produce nested centered boxes: <img alt="concentric blue circles"
1816-
height=191 src="images/target.png" width=210>
1817-
</div>
1818-
18191822
<h3 id=flex-line-pack><span class=secno>8.4. </span> &lsquo;<a
18201823
href="#flex-line-pack0"><code
18211824
class=property>flex-line-pack</code></a>&rsquo; property</h3>
@@ -2885,22 +2888,22 @@ <h2 class=no-num id=index>Index</h2>
28852888
title="authoring tool"><strong>12.2.</strong></a>
28862889

28872890
<li>&lsquo;<code class=css>auto</code>&rsquo;, <a
2888-
href="#flex-item-align-auto" title="''auto''"><strong>8.2.</strong></a>
2891+
href="#flex-item-align-auto" title="''auto''"><strong>8.3.</strong></a>
28892892

28902893
<li>&lsquo;<code class=css>baseline</code>&rsquo;, <a
28912894
href="#flex-align-baseline"
2892-
title="''baseline''"><strong>8.2.</strong></a>
2895+
title="''baseline''"><strong>8.3.</strong></a>
28932896

28942897
<li>break inside a flexbox item is considered, <a
28952898
href="#break-inside-a-flexbox-item-is-considere"
28962899
title="break inside a flexbox item is considered"><strong>10.</strong></a>
28972900

28982901

28992902
<li>&lsquo;<code class=css>center</code>&rsquo;, <a
2900-
href="#flex-align-center" title="''center''"><strong>8.2.</strong></a>,
2903+
href="#flex-align-center" title="''center''"><strong>8.3.</strong></a>,
29012904
<a href="#flex-line-pack-center"
29022905
title="''center''"><strong>8.4.</strong></a>, <a href="#flex-pack-center"
2903-
title="''center''"><strong>8.1.</strong></a>
2906+
title="''center''"><strong>8.2.</strong></a>
29042907

29052908
<li>&lsquo;<code class=css>column</code>&rsquo;, <a
29062909
href="#flex-flow-column" title="''column''"><strong>6.1.</strong></a>
@@ -2930,17 +2933,17 @@ <h2 class=no-num id=index>Index</h2>
29302933
href="#flex-line-pack-distribute"
29312934
title="''distribute''"><strong>8.4.</strong></a>, <a
29322935
href="#flex-pack-distribute"
2933-
title="''distribute''"><strong>8.1.</strong></a>
2936+
title="''distribute''"><strong>8.2.</strong></a>
29342937

29352938
<li>&lsquo;<code class=css>end</code>&rsquo;, <a href="#flex-align-end"
2936-
title="''end''"><strong>8.2.</strong></a>, <a href="#flex-line-pack-end"
2939+
title="''end''"><strong>8.3.</strong></a>, <a href="#flex-line-pack-end"
29372940
title="''end''"><strong>8.4.</strong></a>, <a href="#flex-pack-end"
2938-
title="''end''"><strong>8.1.</strong></a>
2941+
title="''end''"><strong>8.2.</strong></a>
29392942

29402943
<li>flex, <a href="#flex" title=flex><strong>7.</strong></a>
29412944

29422945
<li>flex-align, <a href="#flex-align0"
2943-
title=flex-align><strong>8.2.</strong></a>
2946+
title=flex-align><strong>8.3.</strong></a>
29442947

29452948
<li>flexbox, <a href="#display-flexbox"
29462949
title=flexbox><strong>3.</strong></a>, <a href="#flexbox"
@@ -2974,7 +2977,7 @@ <h2 class=no-num id=index>Index</h2>
29742977
title="flexible length's"><strong>7.</strong></a>
29752978

29762979
<li>flex-item-align, <a href="#flex-item-align"
2977-
title=flex-item-align><strong>8.2.</strong></a>
2980+
title=flex-item-align><strong>8.3.</strong></a>
29782981

29792982
<li>flex-line-pack, <a href="#flex-line-pack0"
29802983
title=flex-line-pack><strong>8.4.</strong></a>
@@ -2983,7 +2986,7 @@ <h2 class=no-num id=index>Index</h2>
29832986
title=flex-order><strong>6.4.</strong></a>
29842987

29852988
<li>flex-pack, <a href="#flex-pack0"
2986-
title=flex-pack><strong>8.1.</strong></a>
2989+
title=flex-pack><strong>8.2.</strong></a>
29872990

29882991
<li>flex-wrap, <a href="#flex-wrap0"
29892992
title=flex-wrap><strong>6.2.</strong></a>
@@ -3001,7 +3004,7 @@ <h2 class=no-num id=index>Index</h2>
30013004
<li>&lsquo;<code class=css>justify</code>&rsquo;, <a
30023005
href="#flex-line-pack-justify"
30033006
title="''justify''"><strong>8.4.</strong></a>, <a
3004-
href="#flex-pack-justify" title="''justify''"><strong>8.1.</strong></a>
3007+
href="#flex-pack-justify" title="''justify''"><strong>8.2.</strong></a>
30053008

30063009
<li>main axis, <a href="#main-axis"
30073010
title="main axis"><strong>2.</strong></a>
@@ -3046,12 +3049,12 @@ <h2 class=no-num id=index>Index</h2>
30463049
title=single-line><strong>5.</strong></a>
30473050

30483051
<li>&lsquo;<code class=css>start</code>&rsquo;, <a
3049-
href="#flex-align-start" title="''start''"><strong>8.2.</strong></a>, <a
3052+
href="#flex-align-start" title="''start''"><strong>8.3.</strong></a>, <a
30503053
href="#flex-line-pack-start" title="''start''"><strong>8.4.</strong></a>,
3051-
<a href="#flex-pack-start" title="''start''"><strong>8.1.</strong></a>
3054+
<a href="#flex-pack-start" title="''start''"><strong>8.2.</strong></a>
30523055

30533056
<li>&lsquo;<code class=css>stretch</code>&rsquo;, <a
3054-
href="#flex-align-stretch" title="''stretch''"><strong>8.2.</strong></a>,
3057+
href="#flex-align-stretch" title="''stretch''"><strong>8.3.</strong></a>,
30553058
<a href="#flex-line-pack-stretch"
30563059
title="''stretch''"><strong>8.4.</strong></a>
30573060

0 commit comments

Comments
 (0)