@@ -376,7 +376,7 @@ Container Queries: the ''@container'' rule</h2>
376376 The syntax of the ''@container'' rule is:
377377
378378 <pre class="prod def">
379- @container <<container-name>> ? <<container-query-list>> {
379+ @container <<container-name>> | [ name( <<container-name>> ) || type( <<container-type>> +) ] ? <<container-query-list>> {
380380 <<stylesheet>>
381381 }
382382 </pre>
@@ -393,23 +393,26 @@ Container Queries: the ''@container'' rule</h2>
393393
394394 For each element,
395395 the [=query container=] to be queried
396- is determined by the following container selection process:
396+ is selected from the element’s ancestor [=query containers=] .
397+ The optional <dfn><<container-name>></dfn>
398+ filters the set of [=query containers=] considered
399+ to just those with a matching [=query container name=] ,
400+ and the optional <dfn><<container-type>></dfn>
401+ filters the set to just those with matching 'container-type' s.
402+ The nearest remaining [=query container=] ancestor is selected.
397403
398- 1. Start with a list of all the element's ancestor [=query containers=] .
399- 2. The optional <dfn><<container-name>></dfn>
400- filters the set of [=query containers=] considered
401- to just those with a matching [=query container name=] .
402- 3. Select the nearest remaining [=query container=] ancestor.
403- 4. If no ancestor is an eligible [=query container=] ,
404- then the [=container query=] is ''unknown'' for that element.
404+ Note: A [=query container=] with a 'container-type' of ''container-type/size''
405+ is a match for both ''container-type/inline-size'' and ''container-type/block-size''
406+ <<container-type>> s.
405407
406- Issue: Do missing containers evaluate false or unknown?
408+ Issue(6393): Provide a syntax to query a specific container-type
407409
408- If an eligible [=query container=] has been selected,
410+ Once an eligible [=query container=] has been selected for an element ,
409411 each [=container feature=] in the <<container-query-list>>
410412 is evaluated against that [=query container=] .
411413 If the selected [=query container=]
412414 is not a valid 'container-type' for the feature,
415+ or no ancestor is an eligible [=query container=] ,
413416 then the [=container query=] is ''unknown'' for that element.
414417
415418 <div class=example>
@@ -427,9 +430,12 @@ Container Queries: the ''@container'' rule</h2>
427430 meets both the '@container/inline-size' and [=style queries|style=] conditions.
428431 </div>
429432
430- Issue(6393): Provide a syntax to query a specific container-type?
433+ Style rules defined on an element inside multiple nested [=container queries=]
434+ apply when all of the wrapping [=container queries=] are ''true'' for that element.
431435
432- Issue: Define how nested container queries are evaluated
436+ Note: Nested [=container queries=] may evaluate in relation to different containers,
437+ so it is not possible to merge the individual <<container-query-list>> s
438+ into a single query.
433439
434440<h2 id="container-features">
435441Container Features</h2>
@@ -485,8 +491,6 @@ Dimensional Container Features</h3>
485491 the query condition will be true above ''960px'' .
486492 </div>
487493
488- Issue: Evaluate to "unknown" if inline-/block-/size containment is missing.
489-
490494<h4 id="width">
491495Width: the '@container/width' feature</h4>
492496
@@ -600,17 +604,17 @@ State Container Features</h3>
600604 whether a ''position: sticky'' box is displaced from its in-flow position,
601605 or whether the box is visible on screen.
602606
603- Issue: Define a syntax for state-based container queries
607+ Issue(6402) : Define a syntax for state-based container queries
604608
605609<h2 id="container-lengths">
606610Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax'' units</h2>
607611
608- <dfn lt="container length">Container length units</dfn>
609- specify a length relative to another length .
610- Style sheets that use relative units can more easily move components
612+ <dfn lt="query length">Query length units</dfn>
613+ specify a length relative to the dimensions of a [=query container=] .
614+ Style sheets that use [=query length=] units can more easily move components
611615 from one [=query container=] to another.
612616
613- The [=container length=] units are:
617+ The [=query length=] units are:
614618
615619 <table class="data">
616620 <caption> Informative Summary of Container Units</caption>
@@ -634,14 +638,14 @@ Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax
634638 </table>
635639
636640 For each element,
637- [=container length=] units are evaluated
638- as [=dimensional queries=] on the relevant axis or axes
641+ [=query length=] units are evaluated
642+ as [=dimensional queries=] on the relevant axis ( or axes)
639643 described by the unit.
640644 The [=query container=] for each axis
641645 is the nearest ancestor container
642646 that accepts [=dimensional queries=] on that axis.
643- If no eligible [=query container=] is defined on the required axis ,
644- then the [=container length =] on that axis is zero ( ''0'' ) .
647+ If no eligible [=query container=] is available ,
648+ then use the [=small viewport size =] for that axis.
645649
646650 Note: In some cases ''qi'' and ''qb'' units on the same element
647651 will evaluate in relation to different [=query containers=] .
@@ -653,24 +657,18 @@ Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax
653657 they inherit the <a>computed values</a> .
654658
655659 <div class=example>
656- Since container relative units rely on being inside a proper container,
657- and fallback to ''0'' ,
658- it's often useful to establish a minimum value using math functions
659- like ''calc()'' , ''min()'' , ''max()'' , or ''clamp()'' :
660+ Authors can ensure that [=query length=] units
661+ have an appropriate [=query container=]
662+ by applying them inside a [=container query=] with the required <<container-type>> .
663+ Custom fallback values can be defined outside the [=container query=] :
660664
661665 <pre class=lang-css>
662- article {
663- /* calc(1em + 0) = 1em */
664- font-size: calc(1em + 0.2qmin);
665-
666- /* clamp(1em, 0, 3em) = 1em */
667- font-size: clamp(1em, 5qw, 3em);
668-
669- /* clamp(1em, max(0, 3vw), 3em) = clamp(1em, 3vw, 3em) */
670- font-size: clamp(1em, max(5qw, 3vw), 3em);
666+ /* The fallback value does not rely on containment */
667+ h2 { font-size: 1.2em; }
671668
672- /* max(0, 1em) max(0, 1em) = 1em 1em */
673- padding: max(2qh, 1em) max(2qw, 1em);
669+ @container type(inline-size) {
670+ /* only applies when an inline-size container is available */
671+ h2 { font-size: calc(1.2em + 1qi); }
674672 }
675673 </pre>
676674 </div>
0 commit comments