Skip to content

Commit 00d10d5

Browse files
tabatkinsfergald
authored andcommitted
[css-align] Handle cases where safe alignment would disrupt alignment of the box edges. Refactor baseline-alignment conditions slightly to group things together better. Fixes w3c#1556.
1 parent 09b69e1 commit 00d10d5

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

css-align-3/Overview.bs

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -837,20 +837,20 @@ Overflow Alignment: the ''safe'' and ''unsafe'' keywords and scroll safety limit
837837
██████ ███████ ██ ██ ██ ████████ ██ ██ ██
838838
-->
839839

840-
<h2 id='content-distribution'>
840+
<h2 id='content-distribution' dfn lt="content-distribution" export>
841841
Content Distribution: aligning a box's contents within itself</h2>
842842

843-
<h3 id='align-justify-content'>
844-
The 'justify-content' And 'align-content' Properties</h3>
845-
846-
The <dfn export>content-distribution properties</dfn> 'align-content' and 'justify-content'
847-
(and their 'place-content' shorthand)
848-
control alignment of the box's content within its content box.
843+
Content-distribution controls alignment of the box's content within its content box.
844+
It is specified by the <dfn export>content-distribution properties</dfn> 'align-content' and 'justify-content'
845+
(and their 'place-content' shorthand).
849846

850847
<div class="figure">
851848
<img alt="Diagram showing that the alignment of the content within the element is affected." src="images/content-example.svg" width=212 height=212>
852849
</div>
853850

851+
<h3 id='align-justify-content'>
852+
The 'justify-content' And 'align-content' Properties</h3>
853+
854854
<pre class="propdef">
855855
Name: align-content
856856
Value: normal | <<baseline-position>> | <<content-distribution>> | <<overflow-position>>? <<content-position>>
@@ -1075,7 +1075,7 @@ Baseline Content-Alignment</h3>
10751075

10761076
The content of boxes participating in row-like layout contexts (<a>shared alignment contexts</a>)
10771077
can be baseline-aligned to each other.
1078-
<dfn export lt="baseline content-alignment|first-baseline content-alignment|last-baseline content-alignment">baseline content-alignment</dfn> effectively increases the <strong>padding</strong> on the box
1078+
<dfn export lt="baseline content-alignment|first-baseline content-alignment|last-baseline content-alignment">Baseline content-alignment</dfn> effectively increases the <strong>padding</strong> on the box
10791079
to align the <a>alignment baseline</a> of its contents
10801080
with that of other baseline-aligned boxes in its <a>baseline-sharing group</a>.
10811081

@@ -1099,27 +1099,34 @@ Baseline Content-Alignment</h3>
10991099
<dd>
11001100
A <a>flex item</a> participates in first (last) <a>baseline content-alignment</a>
11011101
in its flex line if
1102-
its computed 'align-content' is ''first baseline'' (''last baseline''),
1103-
its <a>inline axis</a> is parallel to the <a>main axis</a>,
1104-
and its computed 'align-self' is ''align-self/stretch'' or ''self-start'' (''self-end'').
1105-
For this purpose,
1106-
the ''start'', ''end'', ''flex-start'', and ''flex-end'' values of 'align-self'
1107-
are treated as either ''self-start'' or ''self-end'',
1108-
whichever they end up equivalent to.
1102+
its computed 'align-content' is ''first baseline'' (''last baseline'')
1103+
and its <a>inline axis</a> is parallel to the <a>main axis</a>.
11091104

11101105
<dt>Grid Items:
11111106
<dd>
11121107
A <a>grid item</a> participates in first (last) <a>baseline content-alignment</a>
11131108
in its startmost (endmost) row or column (whichever is parallel to its <a>inline axis</a>)
1114-
if its computed 'align-content' is ''first baseline'' (''last baseline''),
1115-
and its computed 'align-self' or 'justify-self' (whichever affects its <a>block axis</a>)
1116-
is ''align-self/stretch'' or ''self-start'' (''self-end'').
1117-
For this purpose,
1118-
the ''start'', ''end'', ''flex-start'', and ''flex-end'' values of 'align-self'
1119-
are treated as either ''self-start'' or ''self-end'',
1120-
whichever they end up equivalent to.
1109+
and if its computed 'align-content' is ''first baseline'' (''last baseline'').
11211110
</dl>
11221111

1112+
Additionally, if <a>self-alignment</a> applies to the box in an axis,
1113+
in order to participate in <a>baseline content-alignment</a> in that axis
1114+
it must also have a <dfn>coordinated self-alignment preference</dfn>;
1115+
that is:
1116+
1117+
* If its <a>baseline alignment preference</a> is “first” (“last”),
1118+
the relevant computed <a>self-alignment property</a>
1119+
is either 'align-self/stretch'' or ''self-start'' (''self-end'').
1120+
For this purpose,
1121+
the ''start'', ''end'', ''flex-start'', and ''flex-end'' values
1122+
are treated as either ''self-start'' or ''self-end'',
1123+
whichever they end up equivalent to.
1124+
* Its used self-alignment is not affected by its [=overflow alignment=].
1125+
(That is, the used self-alignment is what would result from an ''unsafe'' [=overflow alignment=].)
1126+
1127+
<!-- This is because such a box is no longer guaranteed to line up the relevant edge with its siblings -->
1128+
It otherwise takes its <a>fallback alignment</a>.
1129+
11231130
See [[#align-by-baseline]] for exact details.
11241131
<a>Baseline content-alignment</a> can increase the intrinsic size of the box.
11251132

@@ -1133,12 +1140,12 @@ Baseline Content-Alignment</h3>
11331140
██████ ████████ ████████ ██
11341141
-->
11351142

1136-
<h2 id='self-alignment'>
1143+
<h2 id='self-alignment' dfn lt="self-alignment" export>
11371144
Self-Alignment: Aligning the Box within its Parent</h2>
11381145

1139-
The <dfn export>self-alignment properties</dfn> 'align-self' and 'justify-self'
1140-
(and their 'place-self' shorthand)
1141-
control alignment of the box within its containing block.
1146+
Self-alignment controls alignment of the box within its containing block.
1147+
It is specified by the <dfn export>self-alignment properties</dfn> 'align-self' and 'justify-self'
1148+
(and their 'place-self' shorthand).
11421149

11431150
<div class="figure">
11441151
<img alt="Diagram showing that the alignment of the element within its containing block is affected." src="images/self-example.svg" width=212 height=212>

0 commit comments

Comments
 (0)