Skip to content

[css-conditional-5] Make <container-query> optional #9192 #11172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions css-conditional-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,14 @@ Naming Query Containers: the 'container-name' property</h3>
.card { margin-inline: 2em; }
}
</pre>

It is also possible to query for a container only based on its name.

<pre class=lang-css>
@container my-page-layout {
.card { padding: 1em; }
}
</pre>
</div>


Expand Down Expand Up @@ -923,7 +931,7 @@ Container Queries: the ''@container'' rule</h3>
where:

<pre class="prod def">
<dfn><<container-condition>></dfn> = [ <<container-name>> ]? <<container-query>>
<dfn><<container-condition>></dfn> = [ <<container-name>>? <<container-query>>? ]!
<dfn><<container-name>></dfn> = <<custom-ident>>
<dfn><<container-query>></dfn> = not <<query-in-parens>>
| <<query-in-parens>> [ [ and <<query-in-parens>> ]* | [ or <<query-in-parens>> ]* ]
Expand Down Expand Up @@ -959,8 +967,7 @@ Container Queries: the ''@container'' rule</h3>
in the <<container-query>>. If the <<container-query>> contains
unknown or unsupported [=container feature=]s,
no [=query container=] will be selected for that <<container-condition>>.
The optional <<container-name>>
filters the set of [=query containers=] considered
The <<container-name>> filters the set of [=query containers=] considered
to just those with a matching [=query container name=].

Once an eligible [=query container=] has been selected for an element,
Expand All @@ -969,6 +976,8 @@ Container Queries: the ''@container'' rule</h3>
If no ancestor is an eligible [=query container=],
then the [=container query=] is ''unknown'' for that element.
As with media queries, <<general-enclosed>> evaluates to ''unknown''.
If the <<container-query>> is omitted, the [=query container=] is eligible as
long as the <<container-name>> matches.

If a [=container query=] includes multiple <<container-condition>>s,
each condition will select it's own [=query container=],
Expand Down