CSS Finally Supports height: auto Transitions, Ending the max-height Hack Era
For over a decade, web developers have relied on workarounds like animating max-height with arbitrarily large pixel values to simulate smooth expand-and-collapse effects in CSS, since transitioning to height: auto was technically impossible. The core problem was that CSS transitions require concrete numeric start and end values, while 'auto' is a layout instruction rather than a number, leaving browsers unable to interpolate between the two. These hacks caused subtle bugs, including clipped content and unnaturally sluggish animations on short panels, because the browser animated toward a guessed maximum rather than the element's real height. Chromium 129 introduced the interpolate-size property, which explicitly permits browsers to treat intrinsic size keywords like auto as animatable values. Setting interpolate-size: allow-keywords in CSS now enables clean, accurate height transitions without any JavaScript measurement or arbitrary pixel guessing.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in