You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-contain-3/Overview.bs
+46-17
Original file line number
Diff line number
Diff line change
@@ -268,11 +268,14 @@ Container Queries</h2>
268
268
[=container queries=] allow testing aspects of elements within the document
269
269
(such as box dimensions or computed styles).
270
270
271
-
A [=query container=] is established by specifying
272
-
the possible query types using the 'container-type' property
271
+
By default, all elements are [=query containers=]
272
+
for the purpose of [=container style queries=],
273
+
and can be established as [=query containers=]
274
+
for [=container size queries=] by specifying
275
+
the additional query types using the 'container-type' property
273
276
(or the 'container'[=shorthand=]).
274
-
Style rules applying to its <a>shadow-including descendants</a> can then be
275
-
conditioned by querying against it,
277
+
Style rules applying to a [=query container=]’s <a>shadow-including descendants</a>
278
+
can be conditioned by querying against it,
276
279
using the ''@container''[=conditional group rule=].
277
280
278
281
<div class=example>
@@ -383,20 +386,29 @@ Creating Query Containers: the 'container-type' property</h3>
383
386
384
387
<pre class='propdef'>
385
388
Name: container-type
386
-
Value: none | style || [ size | inline-size ]
387
-
Initial: style
389
+
Value: normal || [ size | inline-size ]
390
+
Initial: normal
388
391
Inherited: no
389
392
Applies to: all elements
390
-
Computed value: the keyword ''container-type/none'' or one or more of ''container-type/size'', ''container-type/inline-size'', ''container-type/style''
393
+
Computed value: the keyword ''container-type/normal'' or one or more of ''container-type/size'', ''container-type/inline-size''
391
394
Animation type: not animatable
392
395
</pre>
393
396
394
397
The 'container-type' property establishes the element
395
-
as a <dfn export>query container</dfn> for the purpose of [=container queries=],
398
+
as a <dfn export>query container</dfn>
399
+
for the purpose of [=container queries=] that require explicit containment
400
+
(such as [=container size queries=]),
396
401
allowing [=style rules=] styling its descendants
397
-
to query various aspects of its sizing, layout, and style
402
+
to query various aspects of its sizingand layout,
398
403
and respond accordingly.
399
404
405
+
Unless otherwise noted,
406
+
all elements are [=query containers=]
407
+
for the purpose [=container queries=]
408
+
that do no require explicit containment
409
+
(such as [=container style queries=]),
410
+
reagardless of the specified 'container-type'.
411
+
400
412
Values have the following meanings:
401
413
402
414
<dl dfn-type=value dfn-for=container-type>
@@ -416,12 +428,11 @@ Creating Query Containers: the 'container-type' property</h3>
416
428
[=style containment=],
417
429
and [=inline-size containment=]
418
430
to the [=principal box=].
419
-
<dt><dfn>style</dfn>
420
-
<dd>
421
-
Establishes a [=query container=] for [=container style queries=].
422
-
<dt><dfn>none</dfn>
431
+
<dt><dfn>normal</dfn>
423
432
<dd>
424
-
The element is not a [=query container=] for any [=container query=].
433
+
The element is not a [=query container=]
434
+
for any [=container size queries=],
435
+
but remains a [=query container=] for [=container style queries=].
425
436
</dl>
426
437
427
438
<div class=example>
@@ -465,8 +476,6 @@ Creating Query Containers: the 'container-type' property</h3>
465
476
</pre>
466
477
</div>
467
478
468
-
Issue(7066): Should all elements default to a style container-type?
469
-
470
479
471
480
<h3 id="container-name">
472
481
Naming Query Containers: the 'container-name' property</h3>
@@ -598,7 +607,7 @@ Container Queries: the ''@container'' rule</h3>
598
607
For each element,
599
608
the [=query container=] to be queried
600
609
is selected from among the element’s ancestor [=query containers=]
601
-
that have a valid 'container-type'
610
+
that are established as a valid [=query container=]
602
611
for all the [=container features=]
603
612
in the <<container-condition>>.
604
613
The optional <<container-name>>
@@ -634,6 +643,26 @@ Container Queries: the ''@container'' rule</h3>
634
643
so it is not always possible to merge the individual <<container-condition>>s
635
644
into a single query.
636
645
646
+
<div class=example>
647
+
While it is not possible to query multiple containers
648
+
in a single [=container query=],
649
+
that can be achieved by nesting multiple queries:
650
+
651
+
<pre class=lang-css>
652
+
@container card (inline-size > 30em) {
653
+
@container style(--responsive: true) {
654
+
/* styles */
655
+
}
656
+
}
657
+
</pre>
658
+
659
+
The styles above will only be applied
660
+
if there is an ancestor container named "card"
661
+
that meets the '@container/inline-size' condition,
0 commit comments