Skip to content

Commit 25d715e

Browse files
committed
Move 'flex-align' to the flexbox, add 'flex-item-align' for specific control.
1 parent 6807acb commit 25d715e

2 files changed

Lines changed: 136 additions & 37 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 104 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ <h2 class="no-num no-toc" id=table>Table of contents</h2>
190190
property</a>
191191

192192
<li><a href="#flex-align"><span class=secno>5.2. </span> Cross Axis
193-
Alignment: the &lsquo;<code class=property>flex-align</code>&rsquo;
194-
property</a>
193+
Alignment: the &lsquo;<code class=property>flex-align</code>&rsquo; and
194+
&lsquo;<code class=property>flex-item-align</code>&rsquo;
195+
properties</a>
195196
</ul>
196197

197198
<li><a href="#multi-line"><span class=secno>6. </span> Multi-line
@@ -705,8 +706,10 @@ <h3 id=flex-flow><span class=secno>3.1. </span> Flexbox Flow Direction: the
705706
href="#multi-line0"><i>multi-line</i></a>, and the direction of the <a
706707
href="#cross-axis"><i>cross axis</i></a>, which affects the direction new
707708
lines are stacked in and the meaning of the &lsquo;<a
708-
href="#flex-align0"><code class=property>flex-align</code></a>&rsquo; and
709-
&lsquo;<a href="#flex-line-pack0"><code
709+
href="#flex-align0"><code class=property>flex-align</code></a>&rsquo;,
710+
&lsquo;<a href="#flex-item-align"><code
711+
class=property>flex-item-align</code></a>&rsquo;, and &lsquo;<a
712+
href="#flex-line-pack0"><code
710713
class=property>flex-line-pack</code></a>&rsquo; properties.
711714

712715
<dl>
@@ -963,10 +966,11 @@ <h2 id=alignment><span class=secno>5. </span> Alignment</h2>
963966
&lsquo;<a href="#flex-pack0"><code
964967
class=property>flex-pack</code></a>&rsquo; and the <a
965968
href="#cross-axis"><i>cross axis</i></a> with &lsquo;<a
966-
href="#flex-align0"><code class=property>flex-align</code></a>&rsquo;.
967-
These properties make many common types of alignment trivial, including
968-
some things that were very difficult in CSS 2.1, like horizontal and
969-
vertical centering.
969+
href="#flex-align0"><code class=property>flex-align</code></a>&rsquo; and
970+
&lsquo;<a href="#flex-item-align"><code
971+
class=property>flex-item-align</code></a>&rsquo;. These properties make
972+
many common types of alignment trivial, including some things that were
973+
very difficult in CSS 2.1, like horizontal and vertical centering.
970974

971975
<h3 id=flex-pack><span class=secno>5.1. </span> Main Axis Alignment: the
972976
&lsquo;<a href="#flex-pack0"><code
@@ -1088,7 +1092,9 @@ <h3 id=flex-pack><span class=secno>5.1. </span> Main Axis Alignment: the
10881092

10891093
<h3 id=flex-align><span class=secno>5.2. </span> Cross Axis Alignment: the
10901094
&lsquo;<a href="#flex-align0"><code
1091-
class=property>flex-align</code></a>&rsquo; property</h3>
1095+
class=property>flex-align</code></a>&rsquo; and &lsquo;<a
1096+
href="#flex-item-align"><code
1097+
class=property>flex-item-align</code></a>&rsquo; properties</h3>
10921098

10931099
<table class=propdef>
10941100
<tbody>
@@ -1107,6 +1113,44 @@ <h3 id=flex-align><span class=secno>5.2. </span> Cross Axis Alignment: the
11071113

11081114
<td>stretch
11091115

1116+
<tr>
1117+
<th>Applies to:
1118+
1119+
<td>flexboxes
1120+
1121+
<tr>
1122+
<th>Inherited:
1123+
1124+
<td>no
1125+
1126+
<tr>
1127+
<th>Computed Value:
1128+
1129+
<td>specified value
1130+
1131+
<tr>
1132+
<th>Media:
1133+
1134+
<td>visual
1135+
</table>
1136+
1137+
<table class=propdef>
1138+
<tbody>
1139+
<tr>
1140+
<th>Name:
1141+
1142+
<td><dfn id=flex-item-align>flex-item-align</dfn>
1143+
1144+
<tr>
1145+
<th>Value:
1146+
1147+
<td>auto | start | end | center | baseline | stretch
1148+
1149+
<tr>
1150+
<th>Initial:
1151+
1152+
<td>auto
1153+
11101154
<tr>
11111155
<th>Applies to:
11121156

@@ -1128,17 +1172,28 @@ <h3 id=flex-align><span class=secno>5.2. </span> Cross Axis Alignment: the
11281172
<td>visual
11291173
</table>
11301174

1131-
<p>The &lsquo;<a href="#flex-align0"><code
1132-
class=property>flex-align</code></a>&rsquo; property aligns <a
1133-
href="#flexbox-item"><i>flexbox items</i></a> in the <a
1134-
href="#cross-axis"><i>cross axis</i></a> of the current line of the
1175+
<p><a href="#flexbox-item"><i>Flexbox items</i></a> can be aligned in the
1176+
<a href="#cross-axis"><i>cross axis</i></a> of the current line of the
11351177
flexbox, similar to &lsquo;<a href="#flex-pack0"><code
1136-
class=property>flex-pack</code></a>&rsquo; but in the perpendicular axis.
1137-
Note that &lsquo;<a href="#flex-align0"><code
1138-
class=property>flex-align</code></a>&rsquo; applies to individual <a
1139-
href="#flexbox-item"><i>flexbox items</i></a>, while &lsquo;<a
1140-
href="#flex-pack0"><code class=property>flex-pack</code></a>&rsquo;
1141-
applies to the flexbox itself.
1178+
class=property>flex-pack</code></a>&rsquo; but in the perpendendicular
1179+
direction. &lsquo;<a href="#flex-align0"><code
1180+
class=property>flex-align</code></a>&rsquo; sets the default alignment for
1181+
all of the flexbox's <a href="#flexbox-item"><i
1182+
title="flexbox items">items</i></a>, including anonymous <a
1183+
href="#flexbox-item"><i>flexbox items</i></a>. &lsquo;<a
1184+
href="#flex-item-align"><code
1185+
class=property>flex-item-align</code></a>&rsquo; allows this default
1186+
alignment to be overridden for individual <a
1187+
href="#flexbox-item"><i>flexbox items</i></a>.
1188+
1189+
<p>A value of <dfn id=flex-item-align-auto>&lsquo;<code
1190+
class=css>auto</code>&rsquo;</dfn> for &lsquo;<a
1191+
href="#flex-item-align"><code
1192+
class=property>flex-item-align</code></a>&rsquo; makes the <a
1193+
href="#flexbox-item"><i>flexbox item</i></a> use the alignment specified
1194+
by &lsquo;<a href="#flex-align0"><code
1195+
class=property>flex-align</code></a>&rsquo; on its flexbox. The alignments
1196+
are defined as:
11421197

11431198
<dl>
11441199
<dt><dfn id=flex-align-start>start</dfn>
@@ -1168,12 +1223,13 @@ <h3 id=flex-align><span class=secno>5.2. </span> Cross Axis Alignment: the
11681223
class=css>start</code></a>&rsquo;.</p>
11691224

11701225
<p>Otherwise, all <a href="#flexbox-item"><i>flexbox items</i></a> on the
1171-
line with &lsquo;<code class=css>flex-align:baseline</code>&rsquo; that
1172-
don't run afoul of the previous paragraph are aligned such that their
1173-
baselines align, and the item with the largest distance between its
1174-
baseline and its <a href="#cross-start"><i>cross-start</i></a> margin
1175-
edge is placed flush against the <a
1176-
href="#cross-start"><i>cross-start</i></a> edge of the line.</p>
1226+
line with an alignment of &lsquo;<a href="#flex-align-baseline"><code
1227+
class=css>baseline</code></a>&rsquo; that don't run afoul of the
1228+
previous paragraph are aligned such that their baselines align, and the
1229+
item with the largest distance between its baseline and its <a
1230+
href="#cross-start"><i>cross-start</i></a> margin edge is placed flush
1231+
against the <a href="#cross-start"><i>cross-start</i></a> edge of the
1232+
line.</p>
11771233

11781234
<dt><dfn id=flex-align-stretch>stretch</dfn>
11791235

@@ -1205,10 +1261,8 @@ <h3 id=flex-align><span class=secno>5.2. </span> Cross Axis Alignment: the
12051261
div {
12061262
display: flexbox;
12071263
flex-flow: column;
1208-
width: 200px;
1209-
}
1210-
div > div {
12111264
flex-align: center;
1265+
width: 200px;
12121266
}
12131267
&lt;/style></pre>
12141268

@@ -1771,7 +1825,7 @@ <h2 class=no-num id=property>Property index</h2>
17711825

17721826
<td>stretch
17731827

1774-
<td>flexbox items
1828+
<td>flexboxes
17751829

17761830
<td>no
17771831

@@ -1809,6 +1863,21 @@ <h2 class=no-num id=property>Property index</h2>
18091863

18101864
<td>visual
18111865

1866+
<tr>
1867+
<th><a class=property href="#flex-item-align">flex-item-align</a>
1868+
1869+
<td>auto | start | end | center | baseline | stretch
1870+
1871+
<td>auto
1872+
1873+
<td>flexbox items
1874+
1875+
<td>no
1876+
1877+
<td>specified value
1878+
1879+
<td>visual
1880+
18121881
<tr>
18131882
<th><a class=property href="#flex-line-pack0">flex-line-pack</a>
18141883

@@ -1875,6 +1944,9 @@ <h2 class=no-num id=index>Index</h2>
18751944
<!--begin-index-->
18761945

18771946
<ul class=indexlist>
1947+
<li>&lsquo;<code class=css>auto</code>&rsquo;, <a
1948+
href="#flex-item-align-auto" title="''auto''"><strong>5.2.</strong></a>
1949+
18781950
<li>baseline, <a href="#flex-align-baseline"
18791951
title=baseline><strong>5.2.</strong></a>
18801952

@@ -1948,6 +2020,9 @@ <h2 class=no-num id=index>Index</h2>
19482020
<li>flexible length's, <a href="#flexible-length0"
19492021
title="flexible length's"><strong>4.1.</strong></a>
19502022

2023+
<li>flex-item-align, <a href="#flex-item-align"
2024+
title=flex-item-align><strong>5.2.</strong></a>
2025+
19512026
<li>flex-line-pack, <a href="#flex-line-pack0"
19522027
title=flex-line-pack><strong>6.1.</strong></a>
19532028

css3-flexbox/Overview.src.html

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ <h3 id='flex-flow'>
298298
<dd>Same as <i>column</i>, except the <i>main-start</i> and <i>main-end</i> directions are swapped.</dd>
299299
</dl>
300300

301-
<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' and 'flex-line-pack' properties.</p>
301+
<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>
302302

303303
<dl>
304304
<dt><dfn id='flex-flow-no-wrap'>no-wrap</dfn></dt>
@@ -444,7 +444,7 @@ <h3 id='resolving-flexible-lengths'>
444444
<h2 id='alignment'>
445445
Alignment</h2>
446446

447-
<p>After a flexbox's contents have finished their flexing, they can be aligned in both the <i>main axis</i> with 'flex-pack' and the <i>cross axis</i> with 'flex-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>
447+
<p>After a flexbox's contents have finished their flexing, 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>
448448

449449

450450
<h3 id='flex-pack'>
@@ -498,7 +498,7 @@ <h3 id='flex-pack'>
498498

499499

500500
<h3 id='flex-align'>
501-
Cross Axis Alignment: the 'flex-align' property</h3>
501+
Cross Axis Alignment: the 'flex-align' and 'flex-item-align' properties</h3>
502502

503503
<table class=propdef>
504504
<tr>
@@ -510,6 +510,30 @@ <h3 id='flex-align'>
510510
<tr>
511511
<th>Initial:
512512
<td>stretch
513+
<tr>
514+
<th>Applies to:
515+
<td>flexboxes
516+
<tr>
517+
<th>Inherited:
518+
<td>no
519+
<tr>
520+
<th>Computed Value:
521+
<td>specified value
522+
<tr>
523+
<th>Media:
524+
<td>visual
525+
</table>
526+
527+
<table class=propdef>
528+
<tr>
529+
<th>Name:
530+
<td><dfn>flex-item-align</dfn>
531+
<tr>
532+
<th>Value:
533+
<td>auto | start | end | center | baseline | stretch
534+
<tr>
535+
<th>Initial:
536+
<td>auto
513537
<tr>
514538
<th>Applies to:
515539
<td><i>flexbox items</i>
@@ -524,7 +548,9 @@ <h3 id='flex-align'>
524548
<td>visual
525549
</table>
526550

527-
<p>The 'flex-align' property aligns <i>flexbox items</i> in the <i>cross axis</i> of the current line of the flexbox, similar to 'flex-pack' but in the perpendicular axis. Note that 'flex-align' applies to individual <i>flexbox items</i>, while 'flex-pack' applies to the flexbox itself.</p>
551+
<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 perpendendicular 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>.</p>
552+
553+
<p>A value of <dfn id="flex-item-align-auto">''auto''</dfn> for 'flex-item-align' makes the <i>flexbox item</i> use the alignment specified by 'flex-align' on its flexbox. The alignments are defined as:</p>
528554

529555
<dl>
530556
<dt><dfn id="flex-align-start">start</dfn></dt>
@@ -540,7 +566,7 @@ <h3 id='flex-align'>
540566
<dd>
541567
<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>
542568

543-
<p>Otherwise, all <i>flexbox items</i> on the line with ''flex-align: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>
569+
<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>
544570
</dd>
545571

546572
<dt><dfn id="flex-align-stretch">stretch</dfn></dt>
@@ -563,10 +589,8 @@ <h3 id='flex-align'>
563589
div {
564590
display: flexbox;
565591
flex-flow: column;
566-
width: 200px;
567-
}
568-
div > div {
569592
flex-align: center;
593+
width: 200px;
570594
}
571595
&lt;/style></pre>
572596

0 commit comments

Comments
 (0)