Skip to content

Commit a8fea7c

Browse files
committed
[css-contain-3] Describe the container selection process
1 parent 449e57e commit a8fea7c

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

css-contain-3/Overview.bs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ spec:css-break-3; type:dfn; text:fragmentation container
2626
spec:css-break-3; type:dfn; text:fragmentation context
2727
spec:css-break-3; type:dfn; text:fragmented flow
2828
spec:css-contain-2; type:dfn; text:layout containment box
29+
spec:css-contain-2; type:dfn; text:size containment box
2930
spec:css-sizing-4; type:property; text:contain-intrinsic-size
3031
spec:css-sizing-4; type:property; text:aspect-ratio
3132
spec:intersection-observer; type:dfn; text:intersection root
@@ -219,15 +220,13 @@ Creating Query Containers: the 'container-type' property</h2>
219220
</dl>
220221

221222
<div class=example>
222-
Many layouts rely on external sizing for the inline axis,
223-
while allowing the block axis to auto-size based on content.
224-
Establishing an ''container/inline-size'' container makes that behavior explicit,
225-
so that the inline-dimension can be queried,
226-
without impacting normal layout of the block dimensions:
223+
For example, authors can create container-responsive typography,
224+
adjusting 'font-size', 'line-height', and other typographic concerns
225+
based on the size of a container:
227226

228227
<pre class=lang-css>
229-
section {
230-
container: inline-size;
228+
aside, main {
229+
container-type: inline-size;
231230
}
232231

233232
h2 { font-size: 1.2em; }
@@ -237,7 +236,8 @@ Creating Query Containers: the 'container-type' property</h2>
237236
}
238237
</pre>
239238

240-
The ''em'' value is relative to the <a>computed value</a> of 'font-size'
239+
The ''40em'' value used in the query condition
240+
is relative to the [=computed value=] of 'font-size'
241241
on the ''section'' container.
242242
</div>
243243

@@ -247,10 +247,10 @@ Creating Query Containers: the 'container-type' property</h2>
247247

248248
<pre class=lang-css>
249249
section {
250-
container: style;
250+
container-type: style;
251251
}
252252

253-
@container (--cards == true) {
253+
@container (--cards) {
254254
article {
255255
border: thin solid silver;
256256
border-radius: 0.5em;
@@ -392,13 +392,23 @@ Container Queries: the ''@container'' rule</h2>
392392
is true for the element’s [=query container=].
393393

394394
For each element,
395-
the [=query container=] being queried
396-
is its nearest [=query container=] ancestor.
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-
If no ancestor is an eligible [=query container=],
401-
then the [=container query=] is false for that element.
395+
the [=query container=] to be queried
396+
is determined by the following container selection process:
397+
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 ''false'' for that element.
405+
406+
If an eligible [=query container=] has been selected,
407+
each [=container feature=] in the <<container-query-list>>
408+
is evaluated against that [=query container=].
409+
If the selected [=query container=]
410+
is not a valid 'container-type' for the feature,
411+
then the [=container query=] is ''unknown'' for that element.
402412

403413
<div class=example>
404414
As with [=media queries=],
@@ -412,10 +422,10 @@ Container Queries: the ''@container'' rule</h2>
412422

413423
The styles above will only be applied
414424
if there nearest ancestor container named "card"
415-
meets both the '@container/inline-size' and 'style queries|style' conditions.
425+
meets both the '@container/inline-size' and [=style queries|style=] conditions.
416426
</div>
417427

418-
Issue: Provide a syntax to query a specific container-type?
428+
Issue(6393): Provide a syntax to query a specific container-type?
419429

420430

421431
<h2 id="container-features">
@@ -427,6 +437,8 @@ Container Features</h2>
427437
a feature name, a comparator, and a value, all wrapped in parentheses.
428438
[[mediaqueries-5]]
429439

440+
Issue(5989): What container features can be queried?
441+
430442
<h3 id="dimensional-container">
431443
Dimensional Container Features</h3>
432444

@@ -435,7 +447,7 @@ Dimensional Container Features</h3>
435447

436448
If the [=query container=] does not have a [=principal box=],
437449
or the principal box is not a [=layout containment box=],
438-
then the result of evaluating any dimensional container feature is "unknown".
450+
then the result of evaluating any dimensional container feature is ''unknown''.
439451

440452
[=Relative length=] units in [=container queries=]
441453
are based on the the [=computed values=] of the [=query container=].
@@ -458,7 +470,6 @@ Width: the '@container/width' feature</h4>
458470
queries the [=width=]
459471
of the [=query container=]’s [=content box=].
460472

461-
462473
<h4 id="height">
463474
Height: the '@container/height' feature</h4>
464475

@@ -473,7 +484,6 @@ Height: the '@container/height' feature</h4>
473484
queries the [=height=]
474485
of the [=query container=]’s [=content box=].
475486

476-
477487
<h4 id="inline-size">
478488
Inline-size: the '@container/inline-size' feature</h4>
479489

@@ -549,8 +559,6 @@ Style Container Features</h3>
549559
<dfn export>Style queries</dfn> allow querying
550560
the [=computed values=] of the [=query container=].
551561

552-
Issue(5989): What container features can be queried?
553-
554562

555563
<h3 id="state-container">
556564
State Container Features</h3>
@@ -596,11 +604,11 @@ Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax
596604
they inherit the <a>computed values</a>.
597605

598606
For each element,
599-
[=container length=] units are based on
600-
the nearest ancestor [=query container=].
601-
If no ancestor is an eligible [=query container=],
602-
or the nearest [=query container=] is not a container for
603-
[=dimensional queries=] on the unit's axis/axes,
607+
[=container length=] units are evaluated
608+
as [=dimensional queries=] on the relevant axis or axes
609+
described by the unit.
610+
The [=query container=] is always the nearest ancestor container.
611+
If the query cannot be evaluated,
604612
then the [=container length=] is zero (''0'').
605613

606614
<div class=example>

0 commit comments

Comments
 (0)