Skip to content

Commit 81d6bde

Browse files
committed
[css-values-5] Change example in explainer to use preferred interpolate-size syntax.
1 parent b612f45 commit 81d6bde

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

css-values-5/calc-size-explainer.md

+21-17
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,32 @@ this would be a normal intermediate value at 70% of the way through an animation
130130

131131
This is specified [in css-values-5](https://drafts.csswg.org/css-values-5/#calc-size).
132132

133+
## `interpolate-size`
134+
135+
The CSS `interpolate-size` property is an inherited property that takes two values:
136+
`numeric-only` (the initial value) and `allow-keywords`.
137+
It exists because there is enough web content that depends on
138+
intrinsic sizing keywords *not* animating
139+
that we need a way for pages to opt in to allowing these animations.
140+
141+
Since it is an opt-in for compatibility,
142+
it is designed to make it easy to opt in the entire page.
143+
Therefore, it is an inherited property so that it can just be specified once on the root.
144+
It is also not part of any shorthands because being part of a shorthand
145+
would cause use of the shorthand to reset the opt-in.
146+
147+
This is specified [in css-values-5](https://drafts.csswg.org/css-values-5/#interpolate-size).
148+
133149
The following slightly more involved example shows
134150
(while using the separately proposed `::details-content` pseudo-element)
135151
the CSS needed to make a `<details>` element
136152
animate its `height` when it opens and closes:
137153

138154
```css
155+
:root {
156+
interpolate-size: allow-keywords;
157+
}
158+
139159
details::details-content {
140160
--open-close-duration: 500ms;
141161
height: 0;
@@ -144,26 +164,10 @@ details::details-content {
144164
content-visibility var(--open-close-duration) allow-discrete;
145165
}
146166
details[open]::details-content {
147-
height: calc-size(max-content, size);
167+
height: max-content;
148168
}
149169
```
150170

151-
This is specified [in css-values-5](https://drafts.csswg.org/css-values-5/#calc-size).
152-
153-
## `interpolate-size`
154-
155-
The CSS `interpolate-size` property is an inherited property that takes two values:
156-
`numeric-only` (the initial value) and `allow-keywords`.
157-
It exists because there is enough web content that depends on
158-
intrinsic sizing keywords *not* animating
159-
that we need a way for pages to opt in to allowing these animations.
160-
161-
Since it is an opt-in for compatibility,
162-
it is designed to make it easy to opt in the entire page.
163-
Therefore, it is an inherited property so that it can just be specified once on the root.
164-
It is also not part of any shorthands because being part of a shorthand
165-
would cause use of the shorthand to reset the opt-in.
166-
167171
## Detailed design discussion
168172

169173
Much of the design discussion happened in w3c/csswg-drafts#626

0 commit comments

Comments
 (0)