property

Transition property — CSS reference

Selects which changed properties may transition. A list may name individual properties; all selects all transitionable properties and none selects none. Width changes immediately in this example.

Formal Syntax & Structure

css syntaxcss
transition-property: opacity;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>transition-property</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#a{width:100px;height:60px;opacity:0.2;background:#2855ac;color:white;padding:0;transition:opacity 1000ms linear}#a.active{opacity:1;width:200px}
</style><body><button id="toggle" type="button">Toggle panel</button><div id="a">Panel</div><script>const a=document.querySelector("#a");const toggle=document.querySelector("#toggle");toggle.onclick=()=>a.classList.toggle("active");function start(){getComputedStyle(a).opacity;getComputedStyle(a).width;toggle.click();getComputedStyle(a).opacity;getComputedStyle(a).width;return a.getAnimations()}async function sample(t,p="opacity"){const anim=start().find(x=>x.transitionProperty===p);if(!anim)return null;anim.pause();await anim.ready;anim.currentTime=t;return getComputedStyle(a).getPropertyValue(p)}</script></body></html>
CSS Reference