CKTIS / CSS
Lastnost CSS `interpolate-size`
`interpolate-size` določa, ali animacija velikosti lahko interpolira številsko velikost z notranjo ključno besedo, kot je max-content.
Različica: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Sintaksa
numeric-only | allow-keywordsinterpolate-size določa, ali animacija velikosti lahko interpolira številsko velikost z notranjo ključno besedo, kot je max-content.
Primer animira širino od 0 px do max-content, se ustavi na polovici ter izmeri vmesno in polno širino.
Začetna vrednost je numeric-only; lastnost se deduje. Poleg tega odstotki se ne uporabljajo in način interpolacije določa modul.
allow-keywords ne omogoča poljubne interpolacije dveh notranjih besed; ena končna točka mora biti številsko interpolabilna. Lastnost se deduje.
Primeri
<!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>Rezultat
computed=allow-keywords; width=71/142
Primer je bil izveden lokalno v izolirani seji Chrome brez omrežja; rezultat prihaja iz brskalnikovega API CSS.