@@ -295,6 +295,10 @@ allowing multiple elements to use the same set of [=anchor functions=]
295
295
(and [=position fallback lists=] !)
296
296
while changing which [=anchor element=] each is referring to.
297
297
298
+ The [=target anchor element=] selected by the [=default anchor specifier=]
299
+ (if one exists)
300
+ is the element's <dfn>default anchor element</dfn> .
301
+
298
302
Its values are identical to the <<anchor-element>> term
299
303
in ''anchor()'' and ''anchor-size()'' .
300
304
@@ -630,16 +634,77 @@ This has two effects:
630
634
to find one that won't trigger overflow.
631
635
</div>
632
636
637
+ <!--
638
+ ███ ██████ ████████ ██ ██ ████████ ████████ ████████
639
+ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██
640
+ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██
641
+ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ██████ ████████
642
+ █████████ ██ ██ ██ ████ ██ ██ ██ ██
643
+ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██
644
+ ██ ██ ██████ ████████ ██ ██ ██ ████████ ██ ██
645
+ -->
646
+
647
+ <h2 id="anchor-center">
648
+ Centering on the Anchor: the ''anchor-center'' value</h2>
649
+
650
+ <pre class=propdef>
651
+ Name : justify-self, align-self, justify-items, align-items
652
+ New Values : anchor-center
653
+ </pre>
654
+
655
+ The [=self-alignment properties=] allow an [=absolutely-positioned=] element
656
+ to align itself within the [=inset-modified containing block=] .
657
+ The existing values,
658
+ plus carefully chosen [=inset properties=] ,
659
+ are usually enough for useful alignment,
660
+ but a common case for anchored positioning--
661
+ centering over the anchor element--
662
+ requires careful and somewhat complex set-up to achieve.
663
+
664
+ The new <dfn value for="justify-self, align-self, justify-items, align-items">anchor-center</dfn> value
665
+ makes this case extremely simple:
666
+ if the positioned element has a [=default anchor element=] ,
667
+ then it is aligned so as to center itself
668
+ over the [=default anchor element=]
669
+ in the appropriate axis.
670
+ If this alignment would cause it to overflow its [=inset-modified containing block=]
671
+ in the appropriate axis,
672
+ it instead is aligned flush with the side that it would have overflowed;
673
+ if it would overflow both sides,
674
+ it's instead aligned as for ''justify-self/start'' .
675
+
676
+ Additionally,
677
+ if both [=inset properties=] in the appropriate axis are ''top/auto'' ,
678
+ they resolve to the offsets necessary
679
+ to create the largest rectangle possible
680
+ that is centered over the [=default anchor element=]
681
+ and does not overflow the [=containing block=] .
682
+ If only one [=inset property=] is ''top/auto'' ,
683
+ it resolves to ''0'' .
684
+
685
+ Issue: See <a href="https://github.com/w3c/csswg-drafts/issues/9124">Issue 9124</a>
686
+ about making this the behavior in general
687
+ for non-''justify-self/auto'' alignment values.
688
+
689
+ If the element is not [=absolutely positioned=] ,
690
+ or does not have a [=default anchor element=] ,
691
+ this value behaves as ''center''
692
+ and has no additional effect on how [=inset properties=] resolve.
693
+
694
+ Issue: Do we want to hook the "try to stay in the IMCB" behavior to safe vs unsafe?
695
+ Right now it'll only trigger fallback if it overflows both sides;
696
+ it might be useful to be able to trigger fallback
697
+ as soon as it can't center itself.
633
698
634
699
635
700
<!--
636
- ███ ██████ ██████ ████████ ███████ ██ ██
637
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
638
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
639
- ██ ██ ███████ ██████ ██ ████████ ██ ██ ██ ██
640
- █████████ ██ ██ ██ ██ ██ ██ ██ ██
641
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
642
- ██ ██ ██████ ██████ ██ ██ ███████ ████████ ████████
701
+ ██████ ██████ ████████ ███████ ██ ██
702
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
703
+ ██ ██ ██ ██ ██ ██ ██ ██
704
+ ██ ████ ██ ████████ ██ ██ ██ ██
705
+ ██ ██ ██ ██ ██ ██ ██ ██
706
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
707
+ ██████ ██████ ██ ██ ███████ ████████ ████████
643
708
-->
644
709
645
710
Taking Scroll Into Account {#scroll}
@@ -1255,7 +1320,7 @@ the ''@position-fallback'' rule:
1255
1320
<pre class='idl' export>
1256
1321
[Exposed=Window]
1257
1322
interface CSSPositionFallbackRule : CSSGroupingRule {
1258
- readonly attribute CSSOMString name;
1323
+ readonly attribute CSSOMString name;
1259
1324
};
1260
1325
</pre>
1261
1326
@@ -1273,7 +1338,7 @@ declared in a ''@position-fallback'' rule:
1273
1338
<pre class='idl' export>
1274
1339
[Exposed=Window]
1275
1340
interface CSSTryRule : CSSRule {
1276
- [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
1341
+ [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
1277
1342
};
1278
1343
</pre>
1279
1344
0 commit comments