Skip to content

Commit 3aed70b

Browse files
committed
[css-contain-3] All elements are style containers, initial type is normal (#7066 #7402)
1 parent 0e43fcf commit 3aed70b

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

css-contain-3/Overview.bs

+46-17
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,14 @@ Container Queries</h2>
268268
[=container queries=] allow testing aspects of elements within the document
269269
(such as box dimensions or computed styles).
270270

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
273276
(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,
276279
using the ''@container'' [=conditional group rule=].
277280

278281
<div class=example>
@@ -383,20 +386,29 @@ Creating Query Containers: the 'container-type' property</h3>
383386

384387
<pre class='propdef'>
385388
Name: container-type
386-
Value: none | style || [ size | inline-size ]
387-
Initial: style
389+
Value: normal || [ size | inline-size ]
390+
Initial: normal
388391
Inherited: no
389392
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''
391394
Animation type: not animatable
392395
</pre>
393396

394397
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=]),
396401
allowing [=style rules=] styling its descendants
397-
to query various aspects of its sizing, layout, and style
402+
to query various aspects of its sizing and layout,
398403
and respond accordingly.
399404

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+
400412
Values have the following meanings:
401413

402414
<dl dfn-type=value dfn-for=container-type>
@@ -416,12 +428,11 @@ Creating Query Containers: the 'container-type' property</h3>
416428
[=style containment=],
417429
and [=inline-size containment=]
418430
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>
423432
<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=].
425436
</dl>
426437

427438
<div class=example>
@@ -465,8 +476,6 @@ Creating Query Containers: the 'container-type' property</h3>
465476
</pre>
466477
</div>
467478

468-
Issue(7066): Should all elements default to a style container-type?
469-
470479

471480
<h3 id="container-name">
472481
Naming Query Containers: the 'container-name' property</h3>
@@ -598,7 +607,7 @@ Container Queries: the ''@container'' rule</h3>
598607
For each element,
599608
the [=query container=] to be queried
600609
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=]
602611
for all the [=container features=]
603612
in the <<container-condition>>.
604613
The optional <<container-name>>
@@ -634,6 +643,26 @@ Container Queries: the ''@container'' rule</h3>
634643
so it is not always possible to merge the individual <<container-condition>>s
635644
into a single query.
636645

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,
662+
as well as an ancestor container
663+
meeting [=container style query|style=] condition.
664+
</div>
665+
637666
Global, name-defining [=at-rules=]
638667
such as ''@keyframes'' or ''@font-face'' or ''@layer''
639668
that are defined inside [=container queries=]

0 commit comments

Comments
 (0)