@@ -189,23 +189,23 @@ Creating Query Containers: the 'container-type' property</h2>
189
189
<dl dfn-type=value dfn-for=container-type>
190
190
<dt> <dfn>size</dfn>
191
191
<dd>
192
- Establishes a [=query container=] for [=dimensional queries=]
192
+ Establishes a [=query container=] for [=size queries=]
193
193
on both the [=inline axis|inline=] and [=block axis=] .
194
194
Applies [=layout containment=] ,
195
195
[=style containment=] ,
196
196
and [=size containment=]
197
197
to the [=principal box=] .
198
198
<dt> <dfn>inline-size</dfn>
199
199
<dd>
200
- Establishes a [=query container=] for [=dimensional queries=]
200
+ Establishes a [=query container=] for [=size queries=]
201
201
on the container’s own [=inline axis=] .
202
202
Applies [=layout containment=] ,
203
203
[=style containment=] ,
204
204
and [=inline-size containment=]
205
205
to the [=principal box=] .
206
206
<dt> <dfn>block-size</dfn>
207
207
<dd>
208
- Establishes a [=query container=] for [=dimensional queries=]
208
+ Establishes a [=query container=] for [=size queries=]
209
209
on the container’s own [=block axis=] .
210
210
Applies [=layout containment=] ,
211
211
[=style containment=] ,
@@ -371,41 +371,64 @@ Creating Named Containers: the 'container' shorthand</h2>
371
371
Container Queries: the ''@container'' rule</h2>
372
372
373
373
The <dfn at-rule id="at-ruledef-container">@container</dfn> rule
374
- is a [=conditional group rule=] whose condition is a [=container query=] .
374
+ is a [=conditional group rule=] whose condition is
375
+ a <dfn export>container query</dfn> ,
376
+ which is a boolean combination of [=size queries=] and/or [=style queries=] .
377
+ Style declarations within the <<stylesheet>> block of an ''@container'' rule
378
+ are [[css-cascade-4#filtering|filtered]] by its condition
379
+ to only match when the [=container query=]
380
+ is true for their element’s [=query container=] .
381
+
375
382
376
383
The syntax of the ''@container'' rule is:
377
384
378
385
<pre class="prod def">
379
- @container <<container-name>> | [ name(<<container-name>> ) || type(<<container-type>> +) ]? <<container-query-list>> {
380
- <<stylesheet>>
386
+ @container
387
+ [ <<container-name>> | [ name(<<container-name>> ) || type(<<container-type>> +) ] ]?
388
+ <<container-query>> {
389
+ <<stylesheet>>
381
390
}
382
391
</pre>
383
392
384
- The <dfn><container-query-list></dfn> represents the <dfn export>container query</dfn>
385
- and has the same syntax, parsing, and boolean interpretation as
386
- <<media-condition>> in [[MEDIAQUERIES-4]] ,
387
- but with [=container features=] instead of [=media features=] .
393
+ where:
394
+
395
+ <pre class="prod def">
396
+ <dfn><<container-condition>></dfn> = not <<container-query>>
397
+ | <<container-query>> [ and <<container-query>> ]*
398
+ | <<container-query>> [ or <<container-query>> ]*
399
+ <dfn><<container-query>></dfn> = ( <<container-condition>> )
400
+ | size( <<size-query>> )
401
+ | style( <<style-query>> )
402
+
403
+ <dfn><<size-query>></dfn> = <<size-feature>> | <<size-condition>>
404
+ <dfn><<size-condition>></dfn> = not ( <<size-query>> )
405
+ | ( <<size-query>> ) [ and ( <<size-query>> ) ]*
406
+ | ( <<size-query>> ) [ or ( <<size-query>> ) ]*
407
+
408
+ <dfn><<style-query>></dfn> = <<style-feature>> | <<style-condition>>
409
+ <dfn><<style-condition>></dfn> = not ( <<style-query>> )
410
+ | ( <<style-query>> ) [ and ( <<style-query>> ) ]*
411
+ | ( <<style-query>> ) [ or ( <<style-query>> ) ]*
412
+ </pre>
388
413
389
- Styles in the <<stylesheet>> block of the ''@container'' rule
390
- are [[css-cascade-4#filtering|filtered]] by its condition
391
- to only match when the [=container query=]
392
- is true for the element’s [=query container=] .
393
414
394
415
For each element,
395
416
the [=query container=] to be queried
396
- is selected from the element’s ancestor [=query containers=] .
417
+ is selected from among the element’s ancestor [=query containers=] .
397
418
The optional <dfn><<container-name>></dfn>
398
419
filters the set of [=query containers=] considered
399
420
to just those with a matching [=query container name=] ,
400
421
and the optional <dfn><<container-type>></dfn>
401
- filters the set to just those with matching 'container-type' s .
422
+ filters the set to just those with a matching 'container-type' .
402
423
The nearest remaining [=query container=] ancestor is selected.
403
424
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.
425
+ ISSUE: Should the UA automatically filter to the nearest compatible query container
426
+ if no specific type is provided?
427
+
428
+ ISSUE(6393): Do we like this syntax for querying specific container types?
407
429
408
- Issue(6393): Provide a syntax to query a specific container-type
430
+ A [=query container=] with a 'container-type' of ''container-type/size''
431
+ is a match for both ''container-type/inline-size'' and ''container-type/block-size'' .
409
432
410
433
Once an eligible [=query container=] has been selected for an element,
411
434
each [=container feature=] in the <<container-query-list>>
@@ -431,33 +454,41 @@ Container Queries: the ''@container'' rule</h2>
431
454
</div>
432
455
433
456
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.
457
+ apply when all of the wrapping [=container queries=] are true for that element.
435
458
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
459
+ Note: Nested [=container queries=] can evaluate in relation to different containers,
460
+ so it is not always possible to merge the individual <<container-query-list>> s
438
461
into a single query.
439
462
440
463
<h2 id="container-features">
441
464
Container Features</h2>
442
465
443
466
A <dfn export>container feature</dfn>
444
467
queries a specific aspect of a [=query container=] .
445
- Its syntax is the same as for a [=media feature=] :
446
- a feature name, a comparator, and a value, all wrapped in parentheses.
447
- [[mediaqueries-5]]
448
468
449
469
Issue(5989): What container features can be queried?
450
470
451
- <h3 id="dimensional -container">
452
- Dimensional Container Features</h3>
471
+ <h3 id="size -container">
472
+ Size Container Features</h3>
453
473
454
- <dfn export>Dimensional queries</dfn> allow querying
474
+ A <dfn export>size query</dfn>
475
+ (syntactically represented as <<size-query>> )
476
+ allows querying
455
477
the size of the [=query container=] ’s [=principal box=] .
478
+ It is a boolean combination of
479
+ individual <dfn>size features</dfn> (<<size-feature>> )
480
+ that each query a single, specific dimensional feature of the [=query container=] .
481
+ The syntax of a <dfn><<size-feature>></dfn> is the same as for a [=media feature=] :
482
+ a feature name, a comparator, and a value.
483
+ [[mediaqueries-5]]
484
+ The boolean syntax and logic combining [=size features=] into a <<size-query>>
485
+ is the same as for [=feature queries=] .
486
+ (See ''@supports'' . [[!CSS-CONDITIONAL-3]] )
456
487
457
488
If the [=query container=] does not have a [=principal box=] ,
458
489
or the principal box is not a [=layout containment box=] ,
459
- or the [=query container=] does not support [=dimensional queries=] on the relevant axes,
460
- then the result of evaluating any dimensional container feature is '' unknown'' .
490
+ or the [=query container=] does not support [=size queries=] on the relevant axes,
491
+ then the result of evaluating the [=size feature=] is unknown.
461
492
462
493
[=Relative length=] units in [=container query=] conditions
463
494
are evaluated based on the the [=computed values=] of the [=query container=] .
@@ -591,10 +622,26 @@ Orientation: the '@container/orientation' feature</h4>
591
622
<h3 id="style-container">
592
623
Style Container Features</h3>
593
624
594
- <dfn export>Style queries</dfn> allow querying
625
+ A <dfn export>style queries</dfn>
626
+ (syntactically represented by <<style-query>> )
627
+ allows querying
595
628
the [=computed values=] of the [=query container=] .
596
-
597
- Issue(6396): Define a syntax for style-based container queries
629
+ It is a boolean combination of
630
+ individual <dfn>style features</dfn> (<<style-feature>> )
631
+ that each query a single, specific property of the [=query container=] .
632
+ The syntax of a <dfn><<style-feature>></dfn> is the same as for a [=declaration=]
633
+ [[!CSS-SYNTAX-3]] ,
634
+ and its query is true if
635
+ the [=computed value=] of the given property on the [=query container=]
636
+ matches the given value
637
+ (which is also [=computed value|computed=] with respect to the [=query container=] ),
638
+ unknown if the property or its value is unsupported,
639
+ and false otherwise.
640
+ The boolean syntax and logic combining [=style features=] into a <<style-query>>
641
+ is the same as for [=feature queries=] .
642
+ (See ''@supports'' . [[!CSS-CONDITIONAL-3]] )
643
+
644
+ Issue(6396): Do we like this proposed syntax for style queries?
598
645
599
646
<h3 id="state-container">
600
647
State Container Features</h3>
@@ -639,11 +686,11 @@ Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax
639
686
640
687
For each element,
641
688
[=query length=] units are evaluated
642
- as [=dimensional queries=] on the relevant axis (or axes)
689
+ as [=size queries=] on the relevant axis (or axes)
643
690
described by the unit.
644
691
The [=query container=] for each axis
645
692
is the nearest ancestor container
646
- that accepts [=dimensional queries=] on that axis.
693
+ that accepts [=size queries=] on that axis.
647
694
If no eligible [=query container=] is available,
648
695
then use the [=small viewport size=] for that axis.
649
696
0 commit comments