Skip to content

Commit d9ce129

Browse files
committed
[css-grid-3] Clarify self-alignment. w3c#10275
1 parent 11d14ed commit d9ce129

4 files changed

Lines changed: 49 additions & 3 deletions

File tree

css-grid-3/Overview.bs

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,21 +1162,67 @@ Stacking-axis Content Distribution: the 'align-content'/'justify-content' proper
11621162
Stacking-axis Self Alignment: the 'align-self'/'justify-self' and 'align-items'/'justify-items' properties</h3>
11631163

11641164
In the [=stacking axis=],
1165-
the [=self-alignment properties=] only apply to items that are adjacent to a gap in the layout,
1165+
the [=self-alignment properties=] only apply to items that are adjacent to a gap in the layout,
11661166
i.e. placed in their [=grid track=](s) either immediately before a spanning item
11671167
or as the last item.
11681168
The [=alignment subject=] is the item's [=margin box=],
1169-
and the [=alignment container=] is that box plus the adjacent gap.
1169+
and the [=alignment container=] is that box plus the adjacent “gap”.
1170+
For the last item in a track, the [=alignment container=]
1171+
extends to the lowest bottom outer edge
1172+
among all the last items in all tracks.
11701173

11711174
<figure>
1172-
<img src="images/align-self.png" width="724" height="302" alt="">
1175+
<img src="images/align-self.png" width="724" height="302"
1176+
alt="In a 4-column grid lanes container with 6 items,
1177+
where the last item spans 3 columns
1178+
and is pushed down by the 2nd item,
1179+
leaving a gap below the items in the other three columns,
1180+
alignment is possible for the items adjacent to this gap.
1181+
The alignment container stretches from the top of the item
1182+
to the bottom of the gap below it.
1183+
For the last column,
1184+
which the spanning item doesn't reach,
1185+
it stretches to the bottom of the spanning item
1186+
(the lowest item in the grid prior to alignment).">
11731187
<figcaption>
11741188
The three highlighted items are the only ones with "gaps" following them,
11751189
so they're the only ones that will respond to 'align-items'.
11761190
Their [=alignment containers=] are indicated by the dashed areas.
11771191
</figcaption>
11781192
</figure>
11791193

1194+
<figure>
1195+
<table>
1196+
<thead>
1197+
<tr>
1198+
<th>''align-self: start''
1199+
<th>''align-self: end''
1200+
<tbody>
1201+
<tr>
1202+
<td><img src="images/self-align-stack-start.png"
1203+
alt="In a 3-column grid lanes container with 5 items,
1204+
where the first and third items are short,
1205+
the third item spans two columns,
1206+
and the last item spands all three,
1207+
if the second is taller than the first,
1208+
and the fourth is taller than the second and third,
1209+
two adjacent alignment containers are created:
1210+
one as tall as the second item, into which the first item aligns,
1211+
and one as tall as the third item minus the second item,
1212+
into which the column-spanning fourth item aligns.">
1213+
<td><img src="images/self-align-stack-end.png"
1214+
alt="When the items are aligned to the bottom,
1215+
there is empty space above the fourth item.
1216+
But this space, even though it is adjacent to the space for the first item,
1217+
is not available for the first item,
1218+
which aligns simply to the bottom of the second item.">
1219+
</table>
1220+
<figcaption>
1221+
Alignment of an item does not affect the size or position
1222+
of other items' [=alignment containers=].
1223+
</figcaption>
1224+
</figure>
1225+
11801226
ISSUE(10275): Is this a reasonable definition for how the [=self-alignment properties=] should work in the [=stacking axis=]?
11811227

11821228
<h3 id="grid-lanes-baseline-alignment" oldids="masonry-baseline-alignment">

css-grid-3/images/align-self.png

9.94 KB
Loading
40.3 KB
Loading
40.6 KB
Loading

0 commit comments

Comments
 (0)