Skip to content
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

[css-contain-3] Add Animated Containers section #6672

Merged
merged 2 commits into from
Oct 1, 2021
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
63 changes: 63 additions & 0 deletions css-contain-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:css-sizing-3; type:value; for:width; text:min-content
spec:css-sizing-3; type:value; for:width; text:max-content
spec:css-syntax-3; type:dfn; text:identifier
spec:css-values-4; type:dfn; text:relative length
spec:web-animations-1; type:dfn; text:effect values
</pre>

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

<h3 id="animated-containers">
Animated Containers</h3>

A change in the evaluation of a [=container query=] must be part of a [=style change event=],
even when the change occurred because of [=effect values|animation effects=].

<div class=example>
A transition on a sibling element can indirectly affect the size of a
container, triggering [=style change events=] whenever container queries
change their evaluation as a result:

<pre class=lang-css>
main {
display: flex;
width: 300px;
}

#container {
container: inline-size;
flex: 1;
}

/* Resolved width is initially 200px, but changes as the transition
on #sibling progresses. */
#inner {
transition: 1s background-color;
background-color: tomato;
}

/* When this container query starts (or stops) applying, a transition
must start on background-color on #inner. */
@container (width <= 150px) {
#inner {
background-color: skyblue;
}
}

#sibling {
width: 100px;
transition: width 1s;
}

#sibling:hover {
width: 200px;
}
</pre>

<pre class=lang-html>
&lt;main>
&lt;div id=container>
&lt;div id=inner>Inner&lt;/div>
&lt;/div>
&lt;div id=sibling>Sibling&lt;/div>
&lt;/main>
</pre>

</div>

Changes in [=computed values=] caused by [=query length=] units
must also be part of a [=style change event=].


<h2 id="container-features">
Container Features</h2>

Expand Down