Skip to content

Commit 1836981

Browse files
authored
Merge pull request w3c#6672 from andruud/anim_cq
[css-contain-3] Add Animated Containers section
2 parents 50c4ac1 + e8c73b5 commit 1836981

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

css-contain-3/Overview.bs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ spec:css-sizing-3; type:value; for:width; text:min-content
4040
spec:css-sizing-3; type:value; for:width; text:max-content
4141
spec:css-syntax-3; type:dfn; text:identifier
4242
spec:css-values-4; type:dfn; text:relative length
43+
spec:web-animations-1; type:dfn; text:effect values
4344
</pre>
4445

4546
<h2 id='intro'>
@@ -460,6 +461,68 @@ Container Queries: the ''@container'' rule</h3>
460461
so it is not always possible to merge the individual <<container-query-list>>s
461462
into a single query.
462463

464+
<h3 id="animated-containers">
465+
Animated Containers</h3>
466+
467+
A change in the evaluation of a [=container query=] must be part of a [=style change event=],
468+
even when the change occurred because of [=effect values|animation effects=].
469+
470+
<div class=example>
471+
A transition on a sibling element can indirectly affect the size of a
472+
container, triggering [=style change events=] whenever container queries
473+
change their evaluation as a result:
474+
475+
<pre class=lang-css>
476+
main {
477+
display: flex;
478+
width: 300px;
479+
}
480+
481+
#container {
482+
container: inline-size;
483+
flex: 1;
484+
}
485+
486+
/* Resolved width is initially 200px, but changes as the transition
487+
on #sibling progresses. */
488+
#inner {
489+
transition: 1s background-color;
490+
background-color: tomato;
491+
}
492+
493+
/* When this container query starts (or stops) applying, a transition
494+
must start on background-color on #inner. */
495+
@container (width <= 150px) {
496+
#inner {
497+
background-color: skyblue;
498+
}
499+
}
500+
501+
#sibling {
502+
width: 100px;
503+
transition: width 1s;
504+
}
505+
506+
#sibling:hover {
507+
width: 200px;
508+
}
509+
</pre>
510+
511+
<pre class=lang-html>
512+
&lt;main>
513+
&lt;div id=container>
514+
&lt;div id=inner>Inner&lt;/div>
515+
&lt;/div>
516+
&lt;div id=sibling>Sibling&lt;/div>
517+
&lt;/main>
518+
</pre>
519+
520+
</div>
521+
522+
Changes in [=computed values=] caused by [=query length=] units
523+
must also be part of a [=style change event=].
524+
525+
463526
<h2 id="container-features">
464527
Container Features</h2>
465528

0 commit comments

Comments
 (0)