Skip to content

Commit 475c797

Browse files
committed
[css-anchor-position-1][editiorial] Better structure for position-area prose
1 parent 3e31514 commit 475c797

File tree

1 file changed

+94
-95
lines changed

1 file changed

+94
-95
lines changed

css-anchor-position-1/Overview.bs

Lines changed: 94 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,69 @@ and the edges of the [=default anchor box=].
582582
These lines can be thought of as defining a 3×3 grid;
583583
'position-area' lets you easily specify
584584
what area of this [=position-area grid=] to lay out the positioned box in.
585-
Its syntax is:
585+
586+
<figure>
587+
<img src="images/position-area-example.png" width=400>
588+
<figcaption>
589+
An example of ''position-area: top left'' positioning
590+
in a ''horizontal-tb'' ''dir/ltr'' [=writing mode=].
591+
</figcaption>
592+
</figure>
593+
594+
595+
<dl dfn-for=position-area dfn-type=value>
596+
: <dfn>none</dfn>
597+
:: The property has no effect.
598+
599+
: <dfn><<position-area>></dfn>
600+
::
601+
If the box does not have a [=default anchor box=],
602+
or is not an [=absolutely positioned box=],
603+
this value has no effect.
604+
605+
Otherwise, selects a region of the [=position-area grid=],
606+
and makes that the box's [=containing block=].
607+
608+
Note: This means that the [=inset properties=] specify offsets from the position-area,
609+
and some property values,
610+
like ''max-height: 100%'',
611+
will be relative to the position-area as well.
612+
</dl>
613+
614+
Values other than ''position-area/none'' have the following additional effects:
615+
616+
* The ''align-self/normal'' value for the [=self-alignment properties=]
617+
resolves to a corresponding value, see [[#position-area-alignment]].
618+
* Any ''top/auto'' [=inset properties=] resolve to ''0''.
619+
* The box is not considered to be in a [=legacy alignment mode=]
620+
in either axis.
621+
622+
<h4 id="position-area-grid-resolution">
623+
Resolving the Position Area Grid</h4>
624+
625+
The <dfn export>position-area grid</dfn> is a 3×3 grid,
626+
composed of four grid lines in each axis.
627+
In order (using the [=writing mode=] of the [=containing block=]):
628+
629+
* the [=start=] edge of the box's pre-modification [=containing block=],
630+
or the start edge of the [=default anchor box=]
631+
if that is more [=start=]-ward
632+
* the [=start=] edge of the [=default anchor box=]
633+
* the [=end=] edge of the [=default anchor box=]
634+
* the [=end=] edge of the box's pre-modification [=containing block=],
635+
or the end edge of the [=default anchor box=]
636+
if that is more [=end=]-ward.
637+
638+
Note: When the [=default anchor box=]
639+
is partially or completely outside of the pre-modified [=containing block=],
640+
some of the [=position-area grid's=] rows or columns can be zero-sized.
641+
642+
<h4 id="position-area-syntax">
643+
Syntax of <<position-area>> Values</h4>
644+
645+
Positions are specified as a pair of values,
646+
which can be expressed in [=flow-relative=] or [=physical=] terms.
647+
The allowed syntax of a <<position-area>> value is:
586648

587649
<pre class=prod>
588650
<dfn>&lt;position-area></dfn> = [
@@ -613,83 +675,8 @@ Its syntax is:
613675
]
614676
</pre>
615677

616-
<dl dfn-for=position-area dfn-type=value>
617-
: <dfn>none</dfn>
618-
:: The property has no effect.
619-
620-
: <dfn><<position-area>></dfn>
621-
::
622-
If the box does not have a [=default anchor box=],
623-
or is not an [=absolutely positioned box=],
624-
this value has no effect.
625-
626-
Otherwise, it has the following effects:
627-
628-
* The property selects a region of the [=position-area grid=],
629-
and makes that the box's [=containing block=].
630-
See [[#resolving-spans]] for details.
631-
632-
Note: This means that the [=inset properties=] specify offsets from the position-area,
633-
and some property values,
634-
like ''max-height: 100%'',
635-
will be relative to the position-area as well.
636-
637-
* The ''align-self/normal'' value for the [=self-alignment properties=]
638-
behaves as either ''align-self/start'', ''align-self/end'',
639-
or ''align-self/anchor-center'',
640-
depending on the positioning of the region,
641-
to give a good default alignment for the positioned box.
642-
Again, see [[#resolving-spans]] for details.
643-
644-
* Any ''top/auto'' [=inset properties=] resolve to ''0''.
645-
646-
* The box is not considered to be in a [=legacy alignment mode=]
647-
in either axis.
648-
</dl>
649-
650-
<div class=note>
651-
If the box overflows its [=inset-modified containing block=],
652-
but would still fit within its [=original containing block=],
653-
by default it will “shift” to stay within its [=original containing block=],
654-
even if that violates its normal alignment.
655-
See [[css-align-3#overflow-values]] for details.
656-
657-
This behavior makes it more likely
658-
that positioned boxes remain visible
659-
and within their intended bounds,
660-
even when their [=containing block=]
661-
ends up smaller than anticipated.
662-
663-
For example, a ''position-area: bottom span-right'' value
664-
lets the positioned box stretch
665-
from its anchor's left edge
666-
to its containing block's right edge,
667-
and left-aligns it in that space by default.
668-
But if the positioned box is larger than that space
669-
(such as if the anchor is very close to the right edge of the screen),
670-
it will shift leftwards to stay visible.
671-
</div>
672-
673-
674-
<h4 id=resolving-spans>
675-
Resolving <<position-area>>s</h4>
676-
677-
The <dfn export>position-area grid</dfn> is a 3×3 grid,
678-
composed of four grid lines in each axis.
679-
In order (and using the [=writing mode=] of the [=containing block=]):
680-
681-
* the start edge of the box's pre-modification [=containing block=],
682-
or the start edge of the [=default anchor box=]
683-
if that is more [=start=]-ward
684-
* the start edge of the [=default anchor box=]
685-
* the end edge of the [=default anchor box=]
686-
* the end edge of the box's pre-modification [=containing block=],
687-
or the end edge of the [=default anchor box=]
688-
if that is more [=end=]-ward.
689-
690-
A <<position-area>> selects a region of this grid
691-
by specifying the rows and columns the region occupies,
692-
with each of the two keywords specifying one of them:
678+
The <<position-area>> value selects a region of the [=position area grid=]
679+
by specifying the rows and columns the region occupies as follows:
693680

694681
<dl dfn-type=value dfn-for="position-area, <position-area>">
695682
: <dfn>start</dfn>, <dfn>end</dfn>, <dfn>self-start</dfn>, <dfn>self-end</dfn>
@@ -720,7 +707,7 @@ with each of the two keywords specifying one of them:
720707
: <dfn>span-x-start</dfn>, <dfn>span-x-end</dfn>
721708
: <dfn>span-block-start</dfn>, <dfn>span-block-end</dfn>
722709
: <dfn>span-inline-start</dfn>, <dfn>span-inline-end</dfn>
723-
:: Two rows or columns,
710+
:: Two adjacent rows or columns,
724711
depending on which axis this keyword is specifying:
725712
the center row/column,
726713
and the row/column corresponding to the other half of the keyword
@@ -753,18 +740,19 @@ otherwise, it behaves as if the given keyword was repeated.
753740
(For example, ''position-area/top'' is equivalent to ''top span-all'',
754741
but ''position-area/center'' is equivalent to ''center center''.)
755742

756-
<hr>
743+
<h4 id=position-area-alignment>
744+
Area-specific Default Alignment</h4>
757745

758-
The <<position-area>> also implies a default [=self-alignment=],
746+
Each <<position-area>> also implies a default [=self-alignment=],
759747
which will be used if the [=self-alignment property=] on the box
760748
is ''align-self/normal'':
761749

762-
* If the only the center region in an axis is selected,
763-
or all three regions are selected,
750+
* If the only the center track in an axis is selected,
751+
or all three tracks are selected,
764752
the default alignment in that axis is ''align-self/anchor-center''.
765753
* Otherwise, the default alignment in that axis
766-
is toward the non-specified side region:
767-
if it's specifying the "start" region of its axis,
754+
is toward the non-specified side track:
755+
if it's specifying the "start" track of its axis,
768756
the default alignment in that axis is ''align-self/end''; etc.
769757

770758
<div class=example>
@@ -776,19 +764,30 @@ is ''align-self/normal'':
776764
(making the box's bottom [=margin edge=] flush with the bottom of the ''position-area/top'' region)
777765
and ''justify-self: end''
778766
(making the box's end-side [=margin edge=] flush with the end side of the ''position-area/span-start'' region).
779-
780-
<figure>
781-
<img src="images/position-area-example.png" width=400>
782-
<figcaption>
783-
An example of ''position-area: span-x-start top'' positioning.
784-
</figcaption>
785-
</figure>
786767
</div>
787768

788-
Note: When the [=default anchor box=]
789-
is partially or completely outside of the pre-modified [=containing block=],
790-
some of the [=position-area grid's=] rows or columns can be zero-sized.
769+
<div class=note>
770+
If the box overflows its [=inset-modified containing block=],
771+
but would still fit within its [=original containing block=],
772+
by default it will “shift” to stay within its [=original containing block=],
773+
even if that violates its normal alignment.
774+
See [[css-align-3#overflow-values]] for details.
775+
776+
This behavior makes it more likely
777+
that positioned boxes remain visible
778+
and within their intended bounds,
779+
even when their [=containing block=]
780+
ends up smaller than anticipated.
791781

782+
For example, a ''position-area: bottom span-right'' value
783+
lets the positioned box stretch
784+
from its anchor's left edge
785+
to its containing block's right edge,
786+
and left-aligns it in that space by default.
787+
But if the positioned box is larger than that space
788+
(such as if the anchor is very close to the right edge of the screen),
789+
it will shift leftwards to stay visible.
790+
</div>
792791

793792
<!-- Big Text: anchor()
794793

0 commit comments

Comments
 (0)