What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To transition an element between a fixed height and its natural auto height, opt into intrinsic-size interpolation with interpolate-size: allow-keywords, then transition height. This is the simplest CSS-first approach in browsers that support it; it is not yet a dependable universal solution, so check compatibility for your audience and plan a fallback.
Transition height from 0 to auto
Set the closed state to a length, hide overflow while it is collapsed, and set the open state to auto. The browser can interpolate between the length and the intrinsic size when interpolate-size is enabled:
.panel {
height: 0;
overflow: hidden;
interpolate-size: allow-keywords;
transition: height 250ms ease;
}
.panel.is-open {
height: auto;
}
Your application must toggle .is-open or otherwise change the element between those states. The 250ms duration and easing are examples; adjust them to suit the interface. The open height follows the content rather than a guessed maximum.
Example disclosure markup
A button can toggle the panel class and expose its state to assistive technology. This example shows the markup and CSS; the state toggle itself must be supplied by your application.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
<button type="button" aria-expanded="false" aria-controls="details">
Show details
</button>
<div id="details" class="panel">
<p>Content with a natural height determined by its contents.</p>
</div>
When the control opens the panel, update aria-expanded to true and apply is-open; reverse both changes when it closes. A production implementation should also ensure the panel’s hidden content cannot receive focus while the panel is closed.
What interpolate-size enables—and what it does not
MDN Web Docs describes interpolate-size: allow-keywords as enabling interpolation between a <length-percentage> value and an intrinsic-size value. That is what makes the length-to-auto pattern possible. It does not make transitions between two different intrinsic keywords interpolable.
The property is inherited. Put it on the component, or on an ancestor only if you deliberately want descendants to inherit the opt-in. Keeping it scoped avoids changing interpolation behavior more broadly than intended.
Rank #2
Browser support
MDN classifies interpolate-size as having limited availability and not Baseline. Check its current compatibility information against the actual browsers and versions your users need; do not assume support is equivalent across browsers. Chrome for Developers describes the opt-in and documents Chrome 130 support for intrinsic sizing keywords including auto; that Chrome-specific information does not establish support in other browsers.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteFor browsers without the feature, a transition from a length to auto may not animate as intended. Decide on a fallback appropriate to your component rather than relying on the native transition everywhere.
When calc-size() is useful
Use calc-size() when the target needs arithmetic based on an intrinsic size—for example, height: calc-size(auto, size + 2rem). It provides a way to calculate from the intrinsic size; ordinary calc() does not accept intrinsic keywords for this purpose. For a plain transition to auto, MDN generally prefers interpolate-size, so there is no need to add calc-size() without a calculation to perform.
Rank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
MDN also marks calc-size() as limited availability and not Baseline. Check compatibility before depending on it in a shipped interface.
Choose a fallback based on the component
There is no single fallback recipe that is right for every height animation. Base the choice on whether content height changes, whether surrounding content must move, and which browsers you support.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →- Measured pixel height: Application code can measure the content and animate between explicit lengths where native intrinsic interpolation is unavailable. Re-measure when content changes or the available width changes, and handle interrupted open/close transitions.
- Different visual reveal: If neighboring content does not need to move, a reveal effect that does not animate the box-model height may fit better. Check that the visual result and interaction behavior still meet the component’s needs.
- Native intrinsic interpolation: Use the CSS pattern above when the target browsers support it and the open size should naturally follow the content.
Test content changes, viewport resizing, and a user reversing the transition before it finishes. Those cases expose brittle measurements and state handling that a static demo may not reveal.
Rank #4
Performance and layout trade-offs
Height is a box-model property, so animating it can require layout work as the element changes size. That cost can be justified when neighboring content needs to move with the panel. If the design can achieve the same result without changing the box size, MDN advises preferring a non-box-model property such as transform where practical. A transform-based effect does not make surrounding content flow into a newly expanded space, so it is not a like-for-like substitute for every disclosure.
Troubleshooting
- The panel jumps instead of animating: Confirm that the browser supports
interpolate-size, that the property is in effect on the transitioning element, and that the state changes from a length to an intrinsic keyword. Unsupported browsers need a fallback. - The panel opens but content is clipped: Check whether another rule constrains its height or overflow after opening. The closed-state
overflow: hiddenis useful for clipping during collapse, but make sure the open state is not unintentionally constrained by other styles. - The panel animates, but nearby content does not move: Confirm that the element’s actual height is changing. A visual transform can reveal content without affecting document flow.
- The measured-height fallback breaks after a resize or content update: Recalculate the target when the content or available width changes, and account for transitions interrupted by another state change.
- A calculation involving auto is rejected or does not work: Use
calc-size()for arithmetic based on an intrinsic size, and verify browser support; useinterpolate-sizefor the plain length-to-intrinsic transition.
Or skip the browser setup
If what you need is a screenshot of a page or interface—not a CSS height animation—ScreenshotNeo can return an image or PDF with one API request. Its API is separate from the CSS technique above; it does not replace the implementation of an animation in your site.
For example, this cURL request captures a page as WebP. See the ScreenshotNeo API documentation for setup and options:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchBest Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
- Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; responses report the page verdict and billing status in headers.
- An MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients.
- The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.
Frequently Asked Questions
Can a CSS transition animate between two intrinsic sizes?
No. The opt-in enables interpolation between a length-percentage and an intrinsic size keyword; it does not enable interpolation between two different intrinsic keywords.
Should I use height or transform for an accordion?
Use height when the expanded panel should take up space and push following content down. A transform can create a visual reveal without changing document flow, so it suits a different interaction.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




