Favorites

CSS interpolate-size Property

interpolate-size
CSS PropertyThis property is supported in some modern browsers, but not all.
Updated 22nd November 2026

The interpolate-size property, set to allow-keywords, lets transitions and animations run to and from intrinsic sizes such as height: auto.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

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

Hover to open this panel. It grows to its content height (height: auto). With allow-keywords it animates; without it, it jumps. Extra lines of text here.
Demo Code
HTML Code
<div class="demo-element">
	<div class="demo-panel">Hover to open this panel. It grows to its content height (height: auto). With allow-keywords it animates; without it, it jumps. Extra lines of text here.</div>
</div>
CSS Code
.demo-element .demo-panel {
	height: 40px;
	overflow: hidden;
	padding: 0 12px;
	background: #e7ecff;
	border: 2px solid #4361ee;
	font-size: 15px;
	line-height: 36px;
	transition: height 0.6s;
}
.demo-element:hover .demo-panel {
	height: auto;
}
.demo-element {
	width: 260px;
	interpolate-size: numeric-only;
}

Syntax

interpolate-size: numeric-only | allow-keywords;

Values

  • numeric-onlyThe default. Intrinsic size keywords such as auto cannot 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

<div class="panel">
<h3>Hover to expand</h3>
<p>This content was hidden. Thanks to interpolate-size the panel grows smoothly to its natural height instead of jumping open.</p>
<p>It works for any amount of content.</p>
</div>
:root {
  interpolate-size: allow-keywords;   /* opt in once */
}

.panel {
  width: 280px;
  height: 48px;               /* collapsed */
  overflow: hidden;
  background: #e7ecff;
  border-radius: 8px;
  padding: 0 14px;
  font-family: system-ui, sans-serif;
  transition: height 0.5s ease;
}

.panel:hover {
  height: auto;               /* now animates smoothly */
}

.panel h3 {
  margin: 0;
  line-height: 48px;
}
Open in editor

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.

This property is supported in some modern browsers, but not all.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee