Skip to content

Commit a595144

Browse files
committed
[css-align-3] Static position calculations should be keying off abspos’s self-alignment (like everything else) not CB's content-alignment. Define this every clearly. w3c#1432
1 parent 082f9e5 commit a595144

File tree

1 file changed

+74
-59
lines changed

1 file changed

+74
-59
lines changed

css-align-3/Overview.bs

+74-59
Original file line numberDiff line numberDiff line change
@@ -918,9 +918,7 @@ The 'justify-content' and 'align-content' Properties</h3>
918918
<tr>
919919
<th>'justify-content' Axis
920920
<td>
921-
Does not apply to and has no effect on <a>block containers</a>
922-
except insofar as it affects absolutely-positioned elements,
923-
see [[#distribution-abspos-static]].
921+
Does not apply to and has no effect on <a>block containers</a>.
924922
<tr>
925923
<th>''justify-content/normal'' Behavior
926924
<td>
@@ -936,62 +934,6 @@ The 'justify-content' and 'align-content' Properties</h3>
936934
''justify-content/normal'' otherwise behaves as ''start''.
937935
</table>
938936

939-
### Static Position of Absolutely-Positioned Boxes ### {#distribution-abspos-static}
940-
941-
When sizing absolutely-positioned boxes
942-
whose inline-axis offsets are both ''left/auto''
943-
according to [[CSS2#abs-non-replaced-width]] and [[CSS2#abs-replaced-width]],
944-
wherever the 'direction' property of the <a>static-position containing block</a> is referenced,
945-
instead reference the value of the 'justify-content' or 'align-content' property
946-
(whichever is defined to apply to the <a>static-position containing block</a>’s <a>inline axis</a>),
947-
treating ''justify-content/normal'' as ''start''
948-
and any <a>distributed alignment</a> value as its <a>fallback alignment</a>.
949-
For example,
950-
when 'direction' is ''ltr'' and 'justify-content' is ''justify-content/end'',
951-
apply the rules for ''direction: rtl'';
952-
when 'direction' is ''rtl'' and 'justify-content' is ''justify-content/space-between'',
953-
apply the rules for ''direction: rtl'';
954-
etc.
955-
956-
Fundamentally these rules set one of the ''left/auto'' insets
957-
(by default, the start-edge inset)
958-
to the corresponding edge of the <a>static position rectangle</a>
959-
and the other to the corresponding edge of the <a>containing block</a>
960-
(i.e. set the inset to zero).
961-
For the case of ''justify-content/center'' (or its equivalent),
962-
split the difference:
963-
when both 'inset-inline-start' and 'inset-inline-end'
964-
('left' and 'right' in horizontal LTR <a>writing modes</a>)
965-
are ''left/auto'',
966-
set both sides to match the <a>static position</a>.
967-
The absolutely-positioned box is then sized into
968-
the resulting space (floored at zero).
969-
970-
Note: The 'align-self'/'justify-self' properties
971-
additionally modify the sizing and positioning rules
972-
specified in [[!CSS2]].
973-
For example, ''justify-self: stretch'' will replace
974-
shrink-to-fit sizing with <a>stretch-fit</a> sizing.
975-
976-
<div class="example">
977-
What this means is that,
978-
instead of always sizing an absolutely-positioned element
979-
within the available space between
980-
its inline-start <a>static position</a>
981-
and its inline-end <a>containing block</a> edge,
982-
the author can choose to instead use the space between
983-
its inline-start <a>containing block</a> edge
984-
and inline-end <a>static position</a>
985-
or between its inline-start and inline-end <a>static positions</a>
986-
by changing the <a>static-position containing block</a>’s
987-
<a>content-distribution properties</a>.
988-
989-
<figure>
990-
<img src="images/place-content-abspos.svg" width=480 height=330 alt="">
991-
<figcaption>An illustration of the above rules.</figcaption>
992-
</figure>
993-
</div>
994-
995937
### Multicol Containers ### {#distribution-multicol}
996938

997939
<table class="data align-details">
@@ -1700,6 +1642,79 @@ Baseline Self-Alignment</h3>
17001642
See [[#align-by-baseline]] for exact details.
17011643
<a>Baseline self-alignment</a> can increase the intrinsic size contribution of the box.
17021644

1645+
<h3 id="abspos-sizing">
1646+
Effects on Sizing of Absolutely Positioned Boxes with Static-Position Insets</h3>
1647+
1648+
For absolutely-positioned boxes
1649+
whose inline-axis offsets are both ''left/auto'',
1650+
the <a>available space</a> for calculating the <a>inline size</a>
1651+
is also affected by alignment.
1652+
1653+
In [[CSS2]], this is keyed off of the the 'direction' property
1654+
of the <a>static-position containing block</a>.
1655+
(See <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>
1656+
and <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width">CSS2&sect;10.3.8</a>.)
1657+
Fundamentally these rules set one of the ''left/auto'' insets
1658+
(by default, the start-edge inset)
1659+
to the corresponding edge of the <a>static position rectangle</a>
1660+
and the other to the corresponding edge of the <a>containing block</a>
1661+
(i.e. set the inset to zero).
1662+
1663+
Just as the <a>self-alignment properties</a>
1664+
replace the <a>containing block</a>’s 'direction' for placement,
1665+
they also replace this lookup for sizing.
1666+
Thus,
1667+
when interpreting the rules in
1668+
<a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">CSS2&sect;10.3.7</a>
1669+
and <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-replaced-width">CSS2&sect;10.3.8</a>,
1670+
wherever the 'direction' property of the <a>static-position containing block</a> is referenced,
1671+
instead reference the value of the 'align-self' or 'justify-self' property
1672+
(whichever is defined to apply to the relevant axis),
1673+
treating ''justify-content/normal'' as ''start''
1674+
and any <a>distributed alignment</a> value as its <a>fallback alignment</a>.
1675+
1676+
<figure>
1677+
<img src="images/place-content-abspos.svg" width=480 height=330
1678+
alt="Start alignment sizes into the space between
1679+
the start edge of the static-position rectangle and the end edge of the containing block.
1680+
End alignment sizes into the space between
1681+
the end edge of the static-position rectangle and the start edge of the containg block.
1682+
Center alignment sizes into the space between
1683+
the two edges of the static-position rectangle.">
1684+
<figcaption>
1685+
Instead of always sizing
1686+
within the available space between
1687+
the <a>inline-start</a> <a>static position</a>
1688+
and the <a>inline-end</a> <a>containing block</a> edge,
1689+
an absolutely-positioned element with ''left/auto'' insets
1690+
will be sized with reference to
1691+
the <a>static position rectangle</a>’s edge(s)
1692+
<em>most appropriate</em> to its specified <a>self-alignment</a>.
1693+
</figcaption>
1694+
</figure>
1695+
1696+
<div class="example">
1697+
For example,
1698+
when the box’s <a>containing block</a>’s 'direction' is ''ltr''
1699+
and its own 'justify-self' is ''justify-content/end'',
1700+
apply the rules for ''direction: rtl'';
1701+
when 'direction' is ''rtl'' and 'justify-content' is ''justify-content/space-between'',
1702+
apply the rules for ''direction: rtl'';
1703+
etc.
1704+
For the case of ''justify-content/center'' (or its equivalent),
1705+
set both sides to match the <a>static position</a>.
1706+
The absolutely-positioned box is then sized into
1707+
the resulting space (floored at zero).
1708+
</div>
1709+
1710+
1711+
Note: The 'align-self'/'justify-self' properties
1712+
can also modify additional aspects of sizing:
1713+
for example, ''justify-self: stretch'' will replace
1714+
“shrink-to-fit” (<a>fit-content</a>) sizing into the <a>available space</a>
1715+
with <a>stretch-fit sizing</a> (consuming all of the <a>available space</a>).
1716+
This is an independent effect from the available space adjustment here.
1717+
17031718
<!--
17041719
████ ████████ ████████ ██ ██ ██████
17051720
██ ██ ██ ██ ██ ███ ███ ██ ██

0 commit comments

Comments
 (0)