Skip to content

Commit 91df1a2

Browse files
committed
[css-position-3] Rewrite Abspos layout model section.
1 parent f948d82 commit 91df1a2

1 file changed

Lines changed: 73 additions & 1 deletion

File tree

css-position-3/Overview.bs

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,13 @@ Absolute Positioning</h3>
669669
into this <dfn>inset-modified containing block</dfn>
670670
is as described in [[#abspos-layout]].
671671

672+
If its [=self-alignment property=] in an axis is ''align-self/normal'',
673+
then the [=resolved value=] of its [=weaker inset=] in that axis
674+
is the value necessary to match that edge of its [=inset-modified containing block=]
675+
to the corresponding edge of its [=margin box=]
676+
after [[#abspos-layout|layout]].
677+
(Otherwise the [=resolved value=] is the [=used value=] described above.)
678+
672679
<h4 id="abspos-breaking" oldids="breaking">
673680
Fragmenting Absolutely-positioned Elements</h4>
674681

@@ -725,10 +732,75 @@ Fixed positioning</h3>
725732
<!-- End section: Fixed positioning -->
726733
<!-- End section: Positioning schemes -->
727734

728-
729735
<h2 id="abspos-layout">
730736
Absolute Positioning Layout Model</h2>
731737

738+
[=Absolute positioning=] not only takes a box out of flow,
739+
but also lays it out in its [=containing block=]
740+
(after the final size of the [=containing block=] has been determined)
741+
according to the <dfn lt="absolute positioning layout | absolute postioning layout model">absolute positioning layout model</dfn>:
742+
743+
<ol>
744+
<li>
745+
First, its [=inset-modified containing block=] is calculated,
746+
defining its [=available space=].
747+
(See [[#abspos-insets]].)
748+
Because an [=absolutely positioned box=] can have no effect on the size of its [=containing block=],
749+
its [=available space=] is always [=definite=].
750+
<li>
751+
Next, its width and height are resolved against this [=definite=] [=available space=],
752+
as its [=preferred size=] capped by its [=maximum size=] (if any), floored by its [=minimum size=].
753+
See [[#abspos-auto-size]].
754+
755+
<li>
756+
Then, the value of any ''margin/auto'' margins are calculated,
757+
see [[#abspos-margins]].
758+
759+
<li>
760+
Lastly, its [=margin box=] is aligned within the [=inset-modified containing block=]
761+
as defined by its [=self-alignment properties=].
762+
</ol>
763+
764+
<h3 id="abspos-auto-size">
765+
Automatic Sizes of Absolutely-Positioned Boxes</h3>
766+
767+
The [=automatic size=] of an [=absolutely positioned box=] is resolved against its [=inset-modified containing block=] as follows
768+
(treating ''margin/auto'' [=margins=] as zero):
769+
770+
* If its [=self-alignment property=] in the relevant axis is ''align-self/stretch'',
771+
or if it is ''align-self/normal'' and the box is [=non-replaced=],
772+
its [=automatic size=] is its [=stretch-fit size=].
773+
774+
* If its [=self-alignment property=] in the relevant axis is not ''align-self/stretch'',
775+
or if it is ''align-self/normal'' and the box is [=replaced=],
776+
its [=automatic size=] is its [=fit-content size=].
777+
778+
The [=automatic minimum size=] of an absolutely-positioned box is always zero.
779+
780+
<h3 id="abspos-margins">
781+
Auto Margins of Absolutely-Positioned Boxes</h3>
782+
783+
If either [=inset property=] in the relevant axis is ''top/auto'',
784+
then any ''margin/auto'' [=margins=] resolve to zero.
785+
786+
Otherwise, the <var>remaining space</var> is calculated
787+
as the size of its [=inset-modified containing block=] in the relevant axis
788+
minus the box's used size in the relevant axis,
789+
and this <var>remaining space</var> is divided among
790+
any ''margin/auto'' margins in the relevant axis.
791+
However, if the <var>remaining space</var> is negative
792+
and both margins are ''margin/auto'',
793+
the start margin resolves to zero
794+
and the end margin receives the <var>remaining space</var>.
795+
796+
<h2 id="abspos-old">
797+
Old Absolute Positioning Layout Model</h2>
798+
799+
ISSUE: This section is being replaced with the new [[#abspos-layout]] section.
800+
It is preserved here for comparison:
801+
both models should yield the same result
802+
in [=horizontal writing modes=] when the box’s [=self-alignment=] is ''align-self/normal''.
803+
732804
<h3 id="abs-non-replaced-width">
733805
The Width of Absolutely-Positioned, Non-Replaced Elements</h3>
734806

0 commit comments

Comments
 (0)