Skip to content

Commit 25ca34c

Browse files
committed
[css-contain-3] Query units select appropriate containers
1 parent 46f77c6 commit 25ca34c

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

css-contain-3/Overview.bs

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,17 @@ Style Container Features</h3>
559559
<dfn export>Style queries</dfn> allow querying
560560
the [=computed values=] of the [=query container=].
561561

562+
Issue(6396): Define a syntax for style-based container queries
562563

563564
<h3 id="state-container">
564565
State Container Features</h3>
565566

566567
<dfn export>State queries</dfn> allow querying
567-
miscellaneous states such as
568+
miscellaneous [=query container=] states, such as
568569
whether a ''position: sticky'' box is displaced from its in-flow position,
569570
or whether the box is visible on screen.
570571

572+
Issue: Define a syntax for state-based container queries
571573

572574
<h2 id="container-lengths">
573575
Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax'' units</h2>
@@ -586,38 +588,44 @@ Container Relative Lengths: the ''qw'', ''qh'', ''qi'', ''qb'', ''qmin'', ''qmax
586588
</thead>
587589
<tbody>
588590
<tr><td>''qw''
589-
<td>1% of [=query container=]'s width
591+
<td>1% of a [=query container=]'s [=width=]
590592
<tr><td>''qh''
591-
<td>1% of [=query container=]'s height
593+
<td>1% of a [=query container=]'s [=height=]
592594
<tr><td>''qi''
593-
<td>1% of [=query container=]'s inline size
595+
<td>1% of a [=query container=]'s [=inline size=]
594596
<tr><td>''qb''
595-
<td>1% of [=query container=]'s block size
597+
<td>1% of a [=query container=]'s [=block size=]
596598
<tr><td>''qmin''
597-
<td>1% of [=query container=]'s smaller dimension
599+
<td>The smaller value of ''qi'' or ''qb''
598600
<tr><td>''qmax''
599-
<td>1% of [=query container=]'s larger dimension
601+
<td>The larger value of ''qi'' or ''qb''
600602
</tbody>
601603
</table>
602604

603-
Child elements do not inherit the relative values as specified for their parent;
604-
they inherit the <a>computed values</a>.
605-
606605
For each element,
607606
[=container length=] units are evaluated
608607
as [=dimensional queries=] on the relevant axis or axes
609608
described by the unit.
610-
The [=query container=] is always the nearest ancestor container.
611-
If the query cannot be evaluated,
612-
then the [=container length=] is zero (''0'').
609+
The [=query container=] for each axis
610+
is the nearest ancestor container
611+
that accepts [=dimensional queries=] on that axis.
612+
If no eligible [=query container=] is defined on the required axis,
613+
then the [=container length=] on that axis is zero (''0'').
614+
615+
Note: In some cases ''qi'' and ''qb'' units on the same element
616+
will evaluate in relation to different [=query containers=].
617+
Similarly, ''qmin'' and ''qmax'' units represent
618+
the larger or smaller of the ''qi'' and ''qb'' units,
619+
even when those dimensions come from different [=query containers=].
620+
621+
Child elements do not inherit the relative values as specified for their parent;
622+
they inherit the <a>computed values</a>.
613623

614624
<div class=example>
615625
Since container relative units rely on being inside a proper container,
616-
it's best to establish a fallback value.
617-
The ''calc()'', ''min()'', ''max()'', and ''clamp()'' functions
618-
can all help with this situation.
619-
620-
Consider these uses, assuming there is no container:
626+
and fallback to ''0'',
627+
it's often useful to establish a minimum value using math functions
628+
like ''calc()'', ''min()'', ''max()'', or ''clamp()'':
621629

622630
<pre class=lang-css>
623631
article {

0 commit comments

Comments
 (0)