Skip to content

Commit

Permalink
[css-position-3] Be consistent with css-align-3 that auto insets are …
Browse files Browse the repository at this point in the history
…stronger than self-alignment #11902
  • Loading branch information
fantasai committed Mar 10, 2025
1 parent 5aae74e commit 6fe8590
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions css-position-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ Resolvings Insets for the “Inset-Modified Containing Block”</h4>
is reduced (possibly becoming negative)
to bring that size up to zero.
In the case that only one inset is ''auto'',
that is the <dfn>weaker inset</dfn>;
that is the <dfn>weaker inset</dfn>
(whose opposite inset is the <dfn>stronger inset</dfn>);
otherwise the [=weaker inset=] is the inset of the [=end=] edge
(where [=end=] is interpreted relative to the [=writing mode=] of the [=containing block=]).

Expand Down Expand Up @@ -901,15 +902,8 @@ Absolute Positioning Layout Model</h2>
see [[#abspos-margins]].

<li>
Lastly, its [=margin box=] is aligned within the [=inset-modified containing block=]
as defined by its [=self-alignment properties=].

For this purpose, if neither ''<overflow-position>/safe'' nor ''<overflow-position>/unsafe'' is specified,
the box aligns at an “in-between” level of safety:
it is ''unsafe''-aligned within its [=inset-modified containing block=],
but shifted, if necessary, to not overflow
the union of its [=original containing block=] and its [=inset-modified containing block=]--
unless it is larger than that rectangle, in which case it is start-aligned to it.
Lastly, its [=margin box=] is aligned within the [=inset-modified containing block=],
see [[#abspos-alignment]].
</ol>

<h3 id="abspos-auto-size">
Expand Down Expand Up @@ -975,6 +969,27 @@ Auto Margins of Absolutely-Positioned Boxes</h3>
the space distributed to ''margin/auto'' [=margins=]
can be negative in [=absolute positioning=].

<h2 id=abspos-alignment>
Self-Alignment of Absolutely Positioned Boxes</h2>

If the [=computed value=] of either [=inset property=] in an axis is ''inset/auto'',
then its [=margin box=] is aligned to the edge of the [=inset-modified containing block=]
corresponding to its [=stronger inset=]
(even if this would overflow its [=containing block=]).

Otherwise, if either [=margin=] is ''margin/auto'',
its position is resolved according to [[#abspos-margins]].

Otherwise, the box is aligned as specified by
its [=self-alignment property=] in the relevant axis
(as defined by the [=writing mode=] of the [=containing block=]),
using its [=margin box=] as the [=alignment subject=]
and the [=inset-modified containing block=] as the [=alignment container=].
However, if an explicit [=overflow alignment=] is not specified
and its [=margin box=] overflows the [=inset-modified containing block=],
its alignment is adjusted to minimize overflow
as specified in [[css-align-3#auto-safety-position]].

<h2 id="abspos-old">
Old Absolute Positioning Layout Model</h2>

Expand Down

0 comments on commit 6fe8590

Please sign in to comment.