diff --git a/css-conditional-5/Overview.bs b/css-conditional-5/Overview.bs index bc8e240f780..0fe2d42a85d 100644 --- a/css-conditional-5/Overview.bs +++ b/css-conditional-5/Overview.bs @@ -347,10 +347,10 @@ Container Queries [=container queries=] allow testing aspects of elements within the document (such as box dimensions or computed styles). - By default, all elements are [=query containers=] + By default, all elements are query containers for the purpose of [=container style queries=], and can be established as [=query containers=] - for [=container size queries=] by specifying + for [=container size queries=] and [=container scroll-state queries=] by specifying the additional query types using the 'container-type' property (or the 'container' [=shorthand=]). Style rules applying to a [=query container=]’s [=flat tree=] descendants @@ -384,9 +384,9 @@ Container Queries For the ''::part()'' and ''::slotted()'' pseudo-element selectors, - which represent real elements in the DOM tree, query containers can be + which represent real elements in the DOM tree, [=query containers=] can be established by [=flat tree=] ancestors of those elements. - For other pseudo-elements, query containers can be established by + For other pseudo-elements, [=query containers=] can be established by inclusive [=flat tree=] ancestors of their originating element.
Name: container-type - Value: normal | size | inline-size + Value: normal | [ [ size | inline-size ] || scroll-state ] Initial: normal Inherited: no Applies to: all elements @@ -468,20 +468,12 @@ Creating Query Containers: the 'container-type' property Animation type: not animatable- The 'container-type' property establishes the element - as a query container - for the purpose of [=container queries=] that require explicit containment - (such as [=container size queries=]), - allowing [=style rules=] styling its descendants - to query various aspects of its sizing and layout, - and respond accordingly. - - Unless otherwise noted, - all elements are [=query containers=] - for the purpose of [=container queries=] - that do not require explicit [=containment=] - (such as [=container style queries=]), - regardless of the specified 'container-type'. + The 'container-type' property establishes the element as a + [=query container=] for certain types of queries. For size + [=container queries=], which require certain types of containment, elements + are explicitly made [=query containers=] through this property. For other + types of [=query containers=] any element can be a [=query container=], such + as for [=container style queries=]. Values have the following meanings: @@ -502,10 +494,13 @@ Creating Query Containers: the 'container-type' property [=style containment=], and [=inline-size containment=] to the [=principal box=]. +
+ #sticky {
+ container-type: scroll-state;
+ position: sticky;
+ }
+ @container scroll-state(stuck: top) {
+ #sticky-child {
+ background-color: lime;
+ }
+ }
+
+ <The keywords ''container-name/none'', ''and'', ''not'', and ''or'' @@ -1067,6 +1087,185 @@ Style Container Features are [=computed value|computed=] with respect to the [=query container=], the same as other values. +> = [ <> ]? < > < > = <> - < > = not <> - | < > [ [ and < > ]* | [ or < > ]* ] - < > = ( <> ) - | ( < > ) - | style( < > ) - | < > - - < > = not <> - | < > [ [ and < > ]* | [ or < > ]* ] - | < > - < > = ( <> ) - | ( < > ) - | < > + < > = not <> + | < > [ [ and < > ]* | [ or < > ]* ] + < > = ( <> ) + | ( < > ) + | style( < > ) + | scroll-state( < > ) + | < > + + < > = not <> + | < > [ [ and < > ]* | [ or < > ]* ] + | < > + < > = ( <> ) + | ( < > ) + | < > + + < > = not <> + | < > [ [ and < > ]* | [ or < > ]* ] + | < > + < > = ( <> ) + | ( < > ) + | < >
+ Name: stuck + For: @container + Value: top | right | bottom | left | block-start | inline-start | block-end | inline-end + Type: discrete ++ + The '@container/stuck' [=container feature=] queries whether a + ''position/sticky'' positioned container is visually shifted to stay inside + the [=sticky view rectangle=] for the given edge. The logical edges map to + physical based on the direction and writing-mode of the [=query container=]. + None of the values match if the [=query container=] is not [=sticky positioned=]. + + It is possible for two values from opposite axes to match at the same time, + but not for opposite edges along the same axis. + +
+ @container scroll-state((stuck: top) and (stuck: left)) { ... }
+
+
+ Will never match:
+
+ @container scroll-state((stuck: left) and (stuck: right)) { ... }
+
+ + Name: snapped + For: @container + Value: x | y | block | inline + Type: discrete ++ + The '@container/snapped' [=container feature=] queries whether a [=snap target=] + is snapped to its [=snap container=] in the given axis. It matches in the boolean + context if it is snapped in at least one of the directions. + +
+ Name: overflowing + For: @container + Value: top | right | bottom | left | block-start | inline-start | block-end | inline-end + Type: discrete ++ + The '@container/overflowing' [=container feature=] queries whether a + [=scroll container=] has clipped [=scrollable overflow rectangle=] content + in the given direction which is reachable through user initiated scrolling. + That is, '@container/overflowing' does not match for a ''overflow/hidden'' + container, nor for a [=negative scrollable overflow region=]. + + The logical values map to physical based on the direction and writing-mode of + the [=query container=]. None of the values match if the container is not a + [=scroll container=]. + + In the boolean context, the query matches if any of the values match. + +