CSS interpolate-size Property
The interpolate-size property, set to allow-keywords, lets transitions and animations run to and from intrinsic sizes such as height: auto.
Description
The interpolate-size property enables animations and transitions to and from intrinsic size keywords such as auto, min-content, max-content and fit-content. By default a transition from height: 0 to height: auto jumps instantly, because the browser does not interpolate keywords. With interpolate-size: allow-keywords the keyword is converted to its pixel size for the animation, giving smooth expanding panels and accordions without JavaScript.
The property is inherited, so the usual pattern is to opt in once for the whole page with :root { interpolate-size: allow-keywords; }. It only affects interpolation between a length and a keyword; animating between two different keywords is still not possible. An alternative that does not need the opt-in is the calc-size() function.
Definition
- Initial value
- numeric-only
- Applies to
- all elements
- Inherited
- yes
- Computed value
- as specified
- Animatable
- not animatable
- JavaScript syntax
- object.style.interpolateSize
Interactive Demo
Syntax
interpolate-size: numeric-only | allow-keywords;
Values
- numeric-onlyThe default. Intrinsic size keywords such as
autocannot be interpolated; transitions to them jump. - allow-keywordsAllows interpolation between a length-percentage and an intrinsic size keyword (
auto,min-content,max-content,fit-content). - initialSets the property to its initial value.
- inheritTakes the computed value of the parent element.
Example
Browser Support
The following information will show you the current browser support for the CSS interpolate-size property. Hover over a browser icon to see the version that first introduced support for this CSS property.
Desktop





Tablets & Mobile





