CKTIS / CSS
CSS property `interpolate-size`
`interpolate-size` controls whether a size animation may interpolate between a numeric size and an intrinsic keyword such as max-content.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
numeric-only | allow-keywordsinterpolate-size controls whether a size animation may interpolate between a numeric size and an intrinsic keyword such as max-content.
The example animates width from 0 px to max-content, pauses halfway, and measures the intermediate and full widths.
The initial value is numeric-only; the property is inherited. In addition, percentage values do not apply, and the module defines interpolation behavior.
allow-keywords does not enable arbitrary interpolation between two intrinsic keywords; one endpoint must be numerically interpolable. The property is inherited.
Examples
<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
const probe = document.querySelector(".probe");
probe.textContent = "intrinsic width sample";
probe.style.cssText = "display:inline-block;white-space:nowrap;interpolate-size:allow-keywords;width:max-content";
const full = Math.round(probe.getBoundingClientRect().width);
const animation = probe.animate([{width:"0px"},{width:"max-content"}],{duration:1000,fill:"both"});
animation.pause();
animation.currentTime = 500;
const half = Math.round(probe.getBoundingClientRect().width);
document.querySelector("#result").textContent = "computed=" + getComputedStyle(probe).interpolateSize + "; width=" + half + "/" + full;
</script></body></html>Result
computed=allow-keywords; width=71/142
The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.