Skip to content

Commit 503cb67

Browse files
committed
[css-anchor-1] Add auto-same keyword. w3c#7757
1 parent dd4a553 commit 503cb67

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

css-anchor-1/Overview.bs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ The ''anchor()'' function resolves to a <<length>>.
9595
<pre class=prod>
9696
&lt;anchor()> = anchor( <<anchor-element>>? <<anchor-side>>, <<length-percentage>>? )
9797
<dfn><<anchor-element>></dfn> = <<dashed-ident>> | implicit | popover
98-
<dfn><<anchor-side>></dfn> = auto | top | left | right | bottom
98+
<dfn><<anchor-side>></dfn> = auto | auto-same
99+
| top | left | right | bottom
99100
| start | end | self-start | self-end
100101
| <<percentage>> | center
101102
</pre>
@@ -131,8 +132,9 @@ The ''anchor()'' function has three arguments:
131132
refers to the position of the corresponding side
132133
of the [=target anchor element=].
133134

134-
The <dfn value for=anchor()>auto</dfn> keyword
135-
indicates [=automatic anchor positioning=].
135+
The <dfn value for=anchor()>auto</dfn>
136+
and <dfn value for=anchor()>auto-same</dfn> keywords
137+
indicate [=automatic anchor positioning=].
136138
See [[#anchor-auto]] for details.
137139

138140
The physical <<anchor-side>> keywords
@@ -278,11 +280,16 @@ as if by an additional ''translate()'' transform.
278280
<h4 id=anchor-auto>
279281
Automatic Anchor Positioning</h4>
280282

281-
A positioned element can use <dfn>automatic anchor positioning</dfn>
282-
by specifying ''anchor()/auto'' as its <<anchor-side>> value,
283-
causing the element to automatically stick "next to" the [=anchor element=]
284-
in the most obvious way,
285-
and flip to the other side if necessary.
283+
If a positioned element uses the ''anchor()'' function
284+
with the ''anchor()/auto'' or ''auto-same'' keywords
285+
in one of its [=inset properties=],
286+
and the opposing [=inset property=] is ''top/auto'',
287+
then the element is using <dfn>automatic anchor positioning</dfn>
288+
in that property's axis.
289+
This will resolve the ''anchor()'' function's <<anchor-side>>
290+
to the correct side of the anchor element,
291+
and automatically create entries in the [=position fallback list=]
292+
to flip the positioned element to the opposite side if necessary.
286293

287294
[=Automatic anchor positioning=] is only active
288295
if the opposite [=inset property=] is ''top/auto''.
@@ -300,14 +307,18 @@ it's equivalent to ''top: anchor(bottom);'';
300307
when used in ''bottom: anchor(auto);'',
301308
it's equivalent to ''bottom: anchor(top);'';
302309
etc.
310+
The ''anchor()/auto-same'' <<anchor-side>>
311+
behaves as the property it's used in:
312+
''top: anchor(auto-same);''
313+
is equivalent to ''top: anchor(top);'',
314+
etc.
303315

304316
Additionally,
305317
it automatically adds one entry
306318
to the beginning of the element's [=position fallback list=]
307319
(preceding any entries added by 'position-fallback'),
308-
specifying the [=inset property=] the function is used in
309-
as ''top/auto'',
310-
and the opposite property as this property's value.
320+
swapping the value of the [=inset property=] it's used in
321+
and the opposite [=inset property=].
311322

312323
<div class=example>
313324
For example, the following code using [=automatic anchor positioning=]:

0 commit comments

Comments
 (0)