Skip to content

Commit a21ea9c

Browse files
committed
[css-align] Fill in align-self.
1 parent 9a411c2 commit a21ea9c

2 files changed

Lines changed: 178 additions & 32 deletions

File tree

css-align/Overview.html

Lines changed: 118 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ <h2 id=intro><span class=secno>1. </span> Introduction</h2>
260260

261261
<p>CSS Levels 1 and 2 allowed for the alignment of text via ‘<code
262262
class=property>text-align</code>’ and the alignment of blocks by
263-
balancing ‘<a href="#lsquoautorsquo1"><code class=css>auto</code></a>
263+
balancing ‘<a href="#lsquoautorsquo0"><code class=css>auto</code></a>
264264
margins. However, except in table cells, vertical alignment was not
265265
possible. As CSS3 adds further capabilities, the ability to align boxes in
266266
various dimensions becomes more critical. This module attempts to create a
@@ -504,7 +504,7 @@ <h3 id=positional-values><span class=secno>3.1. </span> Positional
504504
<dd>If the ‘<code class=property>width</code>’ or ‘<code
505505
class=property>height</code>’ (as appropriate) of the <a
506506
href="#alignment-subject"><i>alignment subject</i></a> is ‘<a
507-
href="#lsquoautorsquo1"><code class=css>auto</code></a>’, its used
507+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’, its used
508508
value is the length necessary to make the <a
509509
href="#alignment-subject"><i>alignment subject</i></a>’s outer size as
510510
close to the size of the <a href="#alignment-container"><i>alignment
@@ -670,10 +670,10 @@ <h3 id=distribution-values><span class=secno>3.3. </span> Distributed
670670

671671
<dd>If the combined size of the items is less than the size of the <a
672672
href="#alignment-container"><i>alignment container</i></a>, any ‘<a
673-
href="#lsquoautorsquo1"><code class=css>auto</code></a>’-sized items
673+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’-sized items
674674
have their size increased equally so that the combined size exactly fills
675675
the <a href="#alignment-container"><i>alignment container</i></a>.
676-
Otherwise, or if there are no ‘<a href="#lsquoautorsquo1"><code
676+
Otherwise, or if there are no ‘<a href="#lsquoautorsquo0"><code
677677
class=css>auto</code></a>’-sized items, this value is identical to
678678
<a href="#lsquoflex-startrsquo"><code
679679
class=css>flex-start</code></a>’. <span class=note>(For layout modes
@@ -811,16 +811,16 @@ <h2 id=content-distribution><span class=secno>4. </span> Content
811811

812812
<p> Aligns the contents of the box as a whole along the box's
813813
inline/row/main axis. Values other than ‘<a
814-
href="#lsquoautorsquo1"><code class=css>auto</code></a>’ are <a
814+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’ are <a
815815
href="#alignment-values">defined above</a>.
816816

817817
<dl>
818818
<dt>Block Layout:
819819

820820
<dd>
821-
<p>All values other than ‘<a href="#lsquoautorsquo1"><code
821+
<p>All values other than ‘<a href="#lsquoautorsquo0"><code
822822
class=css>auto</code></a>’ force the block container to establish a
823-
new formatting context. ‘<a href="#lsquoautorsquo1"><code
823+
new formatting context. ‘<a href="#lsquoautorsquo0"><code
824824
class=css>auto</code></a>’ otherwise behaves as ‘<a
825825
href="#lsquostartrsquo"><code class=css>start</code></a>’.
826826

@@ -841,7 +841,7 @@ <h2 id=content-distribution><span class=secno>4. </span> Content
841841
<dt>Multicol Layout:
842842

843843
<dd>
844-
<p><a href="#lsquoautorsquo1"><code class=css>auto</code></a>
844+
<p><a href="#lsquoautorsquo0"><code class=css>auto</code></a>
845845
behaves as ‘<a href="#lsquostartrsquo"><code
846846
class=css>start</code></a>’.
847847

@@ -862,7 +862,7 @@ <h2 id=content-distribution><span class=secno>4. </span> Content
862862
<dt>Flex Layout:
863863

864864
<dd>
865-
<p><a href="#lsquoautorsquo1"><code class=css>auto</code></a>
865+
<p><a href="#lsquoautorsquo0"><code class=css>auto</code></a>
866866
computes to ‘<a href="#lsquostretchrsquo0"><code
867867
class=css>stretch</code></a>’.
868868

@@ -890,7 +890,7 @@ <h2 id=content-distribution><span class=secno>4. </span> Content
890890
<dt>Grid Layout:
891891

892892
<dd>
893-
<p><a href="#lsquoautorsquo1"><code class=css>auto</code></a>
893+
<p><a href="#lsquoautorsquo0"><code class=css>auto</code></a>
894894
computes to ‘<a href="#lsquostretchrsquo0"><code
895895
class=css>stretch</code></a>’.
896896

@@ -983,12 +983,12 @@ <h3 id=justify-self-property><span class=secno>5.1. </span>
983983
grammar</abbr>
984984
</table>
985985

986-
<p> Justifies the box within its parent along the inline/row axis: the
986+
<p> Justifies the box within its parent along the inline/row/main axis: the
987987
box's outer edges are aligned within its <a
988988
href="#alignment-container"><i>alignment container</i></a> <a
989989
href="#alignment-values">as described by its alignment value</a>.
990990

991-
<p> The ‘<a href="#lsquoautorsquo1"><code class=css>auto</code></a>
991+
<p> The ‘<a href="#lsquoautorsquo0"><code class=css>auto</code></a>
992992
keyword computes to ‘<a href="#lsquostretchrsquo0"><code
993993
class=css>stretch</code></a>’ on absolutely-positioned elements, and to
994994
the computed value of ‘<a href="#justify-items"><code
@@ -1010,8 +1010,8 @@ <h3 id=justify-self-property><span class=secno>5.1. </span>
10101010
<a href="#alignment-container"><i>alignment container</i></a> is reduced
10111011
by the space taken up by the float. (Note: This is the legacy behavior
10121012
of HTML <code>align</code>.) The <a
1013-
href="#alignment-subject"><i>alignment subject</i></a> is block's margin
1014-
box.
1013+
href="#alignment-subject"><i>alignment subject</i></a> is the block's
1014+
margin box.
10151015

10161016
<p> The default <a href="#overflow-alignment"><i>overflow
10171017
alignment</i></a> is ‘<a href="#lsquosafersquo"><code
@@ -1036,14 +1036,14 @@ <h3 id=justify-self-property><span class=secno>5.1. </span>
10361036
containing block's <i>inline axis</i>.
10371037

10381038
<p>When neither margin in this dimension is ‘<a
1039-
href="#lsquoautorsquo1"><code class=css>auto</code></a>’ and neither
1040-
offset property in this dimension is ‘<a href="#lsquoautorsquo1"><code
1039+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’ and neither
1040+
offset property in this dimension is ‘<a href="#lsquoautorsquo0"><code
10411041
class=css>auto</code></a>’, values other than ‘<a
10421042
href="#lsquostretchrsquo0"><code class=css>stretch</code></a>’ cause
10431043
<a
10441044
href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width">non-replaced
10451045
absolutely-positioned boxes</a> to use shrink-to-fit sizing for
1046-
calculating ‘<a href="#lsquoautorsquo1"><code
1046+
calculating ‘<a href="#lsquoautorsquo0"><code
10471047
class=css>auto</code></a>’ measures, and ‘<a
10481048
href="#justify-self"><code class=property>justify-self</code></a>
10491049
dictates alignment as follows:
@@ -1094,7 +1094,7 @@ <h3 id=justify-self-property><span class=secno>5.1. </span>
10941094

10951095
<p>The <a href="#alignment-container"><i>alignment container</i></a> is
10961096
the <i>grid cell</i>. The <a href="#alignment-subject"><i>alignment
1097-
subject</i></a> is <i>grid item</i>’s margin box. The default <a
1097+
subject</i></a> is the <i>grid item</i>’s margin box. The default <a
10981098
href="#overflow-alignment"><i>overflow alignment</i></a> is ‘<a
10991099
href="#lsquotruersquo"><code class=css>true</code></a>’.
11001100
</dl>
@@ -1177,10 +1177,102 @@ <h3 id=align-self-property><span class=secno>5.2. </span> Block/Cross-Axis
11771177
grammar</abbr>
11781178
</table>
11791179

1180+
<p> Aligns the box within its parent along the block/column/cross axis: the
1181+
box's outer edges are aligned within its <a
1182+
href="#alignment-container"><i>alignment container</i></a> <a
1183+
href="#alignment-values">as described by its alignment value</a>.
1184+
1185+
<p> The ‘<a href="#lsquoautorsquo0"><code class=css>auto</code></a>
1186+
keyword computes to ‘<a href="#lsquostretchrsquo0"><code
1187+
class=css>stretch</code></a>’ on absolutely-positioned elements, and to
1188+
the computed value of ‘<a href="#justify-items"><code
1189+
class=property>justify-items</code></a>’ on the parent (minus any ‘<a
1190+
href="#lsquolegacyrsquo"><code class=css>legacy</code></a>’ keywords) on
1191+
all other boxes.
1192+
11801193
<dl>
1181-
<dt><dfn id=lsquoautorsquo><code class=css>auto</code></dfn>
1194+
<dt>Block-level Boxes:
1195+
1196+
<dd>
1197+
<p>The ‘<a href="#align-self"><code
1198+
class=property>align-self</code></a>’ property does not apply to
1199+
block-level boxes, because there is more than one item in the <i>block
1200+
axis</i>.
1201+
1202+
<dt>Absolutely-positioned Boxes:
1203+
1204+
<dd>
1205+
<p>The ‘<a href="#justify-self"><code
1206+
class=property>justify-self</code></a>’ property applies along its
1207+
containing block's <i>inline axis</i>.
11821208

1183-
<dd> ...
1209+
<p>When neither margin in this dimension is ‘<a
1210+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’ and neither
1211+
offset property in this dimension is ‘<a href="#lsquoautorsquo0"><code
1212+
class=css>auto</code></a>’, values other than ‘<a
1213+
href="#lsquostretchrsquo0"><code class=css>stretch</code></a>’ cause
1214+
<a
1215+
href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height">non-replaced
1216+
absolutely-positioned boxes</a> to use shrink-to-fit sizing for
1217+
calculating ‘<a href="#lsquoautorsquo0"><code
1218+
class=css>auto</code></a>’ measures, and ‘<a
1219+
href="#align-self"><code class=property>align-self</code></a>
1220+
dictates alignment as follows:
1221+
1222+
<p> The <a href="#alignment-container"><i>alignment container</i></a> is
1223+
the box's containing block as modified by the offset properties
1224+
(‘<code class=property>top</code>’/‘<a
1225+
href="#lsquorightrsquo"><code
1226+
class=property>right</code></a>’/‘<code
1227+
class=property>bottom</code>’/‘<a href="#lsquoleftrsquo"><code
1228+
class=property>left</code></a>’). The <a
1229+
href="#alignment-subject"><i>alignment subject</i></a> is the box's
1230+
margin box.
1231+
1232+
<p> The default <a href="#overflow-alignment"><i>overflow
1233+
alignment</i></a> is ‘<a href="#lsquosafersquo"><code
1234+
class=css>safe</code></a>’. In terms of CSS2.1 formatting <a
1235+
href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>, the rules
1236+
for "over-constrained" computations in <a
1237+
href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height">section
1238+
10.6.4</a> are ignored in favor of alignment as specified here and the
1239+
used value of the offset properties are not adjusted to correct for the
1240+
over-constraint.
1241+
1242+
<p> The ‘<a href="#lsquostretchrsquo0"><code
1243+
class=css>stretch</code></a>’ keyword is equivalent to ‘<a
1244+
href="#lsquostartrsquo"><code class=css>start</code></a>’ on replaced
1245+
absolutely-positioned boxes. (This is because CSS 2.1 does not stretch
1246+
replaced elements to fit into fixed offsets.)
1247+
1248+
<dt>Flex Items:
1249+
1250+
<dd>
1251+
<p>The ‘<a href="#align-self"><code
1252+
class=property>align-self</code></a>’ property applies along the
1253+
flexbox's <i>cross axis</i>.
1254+
1255+
<p>The <a href="#alignment-container"><i>alignment container</i></a> is
1256+
the <i>flex line</i> the item is in. The <a
1257+
href="#alignment-subject"><i>alignment subject</i></a> is the <i>flex
1258+
item</i>’s margin box. The default <a
1259+
href="#overflow-alignment"><i>overflow alignment</i></a> is ‘<a
1260+
href="#lsquotruersquo"><code class=css>true</code></a>’. See <a
1261+
href="#CSS3-FLEXBOX"
1262+
rel=biblioentry>[CSS3-FLEXBOX]<!--{{!CSS3-FLEXBOX}}--></a> for details.
1263+
1264+
<dt>Grid Items:
1265+
1266+
<dd>
1267+
<p>The ‘<a href="#align-self"><code
1268+
class=property>align-self</code></a>’ property applies along the
1269+
grid's <i>column axis</i>.
1270+
1271+
<p>The <a href="#alignment-container"><i>alignment container</i></a> is
1272+
the <i>grid cell</i>. The <a href="#alignment-subject"><i>alignment
1273+
subject</i></a> is the <i>grid item</i>’s margin box. The default <a
1274+
href="#overflow-alignment"><i>overflow alignment</i></a> is ‘<a
1275+
href="#lsquotruersquo"><code class=css>true</code></a>’.
11841276
</dl>
11851277

11861278
<h2 id=default-alignment><span class=secno>6. </span> Default Alignment</h2>
@@ -1266,17 +1358,17 @@ <h3 id=justify-items-property><span class=secno>6.1. </span>
12661358
have the following meanings:
12671359

12681360
<dl>
1269-
<dt><dfn id=lsquoautorsquo0><code class=css>auto</code></dfn>
1361+
<dt><dfn id=lsquoautorsquo><code class=css>auto</code></dfn>
12701362

12711363
<dd>
12721364
<p> If the element has a parent, and its computed value for ‘<a
12731365
href="#justify-items"><code class=css>justify-items</code></a>
12741366
includes the ‘<a href="#lsquolegacyrsquo"><code
12751367
class=css>legacy</code></a>’ keyword, ‘<a
1276-
href="#lsquoautorsquo1"><code class=css>auto</code></a>’ computes to
1368+
href="#lsquoautorsquo0"><code class=css>auto</code></a>’ computes to
12771369
the parent's value.
12781370

1279-
<p> Otherwise, ‘<a href="#lsquoautorsquo1"><code
1371+
<p> Otherwise, ‘<a href="#lsquoautorsquo0"><code
12801372
class=css>auto</code></a>’ computes to:
12811373

12821374
<ul>
@@ -1370,7 +1462,7 @@ <h3 id=align-items-property><span class=secno>6.2. </span> Block/Cross-Axis
13701462
have the following meanings:
13711463

13721464
<dl>
1373-
<dt><dfn id=lsquoautorsquo1><code class=css>auto</code></dfn>
1465+
<dt><dfn id=lsquoautorsquo0><code class=css>auto</code></dfn>
13741466

13751467
<dd>
13761468
<p> Computes to:
@@ -1682,9 +1774,8 @@ <h2 class=no-num id=index> Index</h2>
16821774
title="section 7.2."><strong>7.2.</strong></a>
16831775

16841776
<li><code class=css>auto</code>’, <a href="#lsquoautorsquo"
1685-
title="section 5.2."><strong>5.2.</strong></a>, <a
1686-
href="#lsquoautorsquo0" title="section 6.1."><strong>6.1.</strong></a>,
1687-
<a href="#lsquoautorsquo1" title="section 6.2."><strong>6.2.</strong></a>
1777+
title="section 6.1."><strong>6.1.</strong></a>, <a
1778+
href="#lsquoautorsquo0" title="section 6.2."><strong>6.2.</strong></a>
16881779

16891780
<li><code class=css>baseline</code>’, <a href="#lsquobaselinersquo"
16901781
title="section 3.2."><strong>3.2.</strong></a>

css-align/Overview.src.html

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ <h3 id='justify-self-property'>
535535
</table>
536536

537537
<p>
538-
Justifies the box within its parent along the inline/row axis:
538+
Justifies the box within its parent along the inline/row/main axis:
539539
the box's outer edges are aligned within its <i>alignment container</i>
540540
<a href="#alignment-values">as described by its alignment value</a>.
541541

@@ -558,7 +558,7 @@ <h3 id='justify-self-property'>
558558
and are placed next to a float,
559559
the <i>alignment container</i> is reduced by the space taken up by the float.
560560
(Note: This is the legacy behavior of HTML <code>align</code>.)
561-
The <i>alignment subject</i> is block's margin box.
561+
The <i>alignment subject</i> is the block's margin box.
562562

563563
<p>
564564
The default <i>overflow alignment</i> is ''safe''.
@@ -608,7 +608,7 @@ <h3 id='justify-self-property'>
608608
<p>The 'justify-self' property applies along the grid's <i>row axis</i>.
609609

610610
<p>The <i>alignment container</i> is the <i>grid cell</i>.
611-
The <i>alignment subject</i> is <i>grid item</i>’s margin box.
611+
The <i>alignment subject</i> is the <i>grid item</i>’s margin box.
612612
The default <i>overflow alignment</i> is ''true''.
613613
</dl>
614614

@@ -664,10 +664,65 @@ <h3 id='align-self-property'>
664664
<td><abbr title="follows order of property value definition">per grammar</abbr>
665665
</table>
666666

667+
<p>
668+
Aligns the box within its parent along the block/column/cross axis:
669+
the box's outer edges are aligned within its <i>alignment container</i>
670+
<a href="#alignment-values">as described by its alignment value</a>.
671+
672+
<p>
673+
The ''auto'' keyword computes to
674+
''stretch'' on absolutely-positioned elements,
675+
and to the computed value of 'justify-items' on the parent
676+
(minus any ''legacy'' keywords) on all other boxes.
677+
667678
<dl>
668-
<dt><dfn>''auto''</dfn>
679+
<dt>Block-level Boxes:
680+
<dd>
681+
<p>The 'align-self' property does not apply to block-level boxes,
682+
because there is more than one item in the <i>block axis</i>.
683+
684+
<dt>Absolutely-positioned Boxes:
685+
<dd>
686+
<p>The 'justify-self' property applies along its containing block's <i>inline axis</i>.
687+
688+
<p>When neither margin in this dimension is ''auto''
689+
and neither offset property in this dimension is ''auto'',
690+
values other than ''stretch'' cause <a href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height">non-replaced absolutely-positioned boxes</a>
691+
to use shrink-to-fit sizing for calculating ''auto'' measures,
692+
and 'align-self' dictates alignment as follows:
693+
694+
<p>
695+
The <i>alignment container</i> is the box's containing block
696+
as modified by the offset properties ('top'/'right'/'bottom'/'left').
697+
The <i>alignment subject</i> is the box's margin box.
698+
699+
<p>
700+
The default <i>overflow alignment</i> is ''safe''.
701+
In terms of CSS2.1 formatting [[!CSS21]],
702+
the rules for "over-constrained" computations in <a href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height">section 10.6.4</a>
703+
are ignored in favor of alignment as specified here
704+
and the used value of the offset properties are not adjusted to correct for the over-constraint.
705+
706+
<p>
707+
The ''stretch'' keyword is equivalent to ''start'' on replaced absolutely-positioned boxes.
708+
(This is because CSS 2.1 does not stretch replaced elements to fit into fixed offsets.)
709+
710+
<dt>Flex Items:
669711
<dd>
670-
...
712+
<p>The 'align-self' property applies along the flexbox's <i>cross axis</i>.
713+
714+
<p>The <i>alignment container</i> is the <i>flex line</i> the item is in.
715+
The <i>alignment subject</i> is the <i>flex item</i>’s margin box.
716+
The default <i>overflow alignment</i> is ''true''.
717+
See [[!CSS3-FLEXBOX]] for details.
718+
719+
<dt>Grid Items:
720+
<dd>
721+
<p>The 'align-self' property applies along the grid's <i>column axis</i>.
722+
723+
<p>The <i>alignment container</i> is the <i>grid cell</i>.
724+
The <i>alignment subject</i> is the <i>grid item</i>’s margin box.
725+
The default <i>overflow alignment</i> is ''true''.
671726
</dl>
672727

673728
<h2 id='default-alignment'>

0 commit comments

Comments
 (0)