Rara slides a cloth along the bar of Mrs. Lastri’s frame: write a transition, trigger it, and each property’s progress is read from the browser every frame…
Hovers, toggles, accordions and dropdowns that feel smooth: all transitions. The right duration and timing function make a UI feel responsive; the wrong ones feel sluggish or janky. And some properties (like display) refuse to transition without a trick.
A transition animates a change, along its timing function’s curve
transition: all, some property animates that was not meant to all animates every property that changes, including width or padding that make layout be redone every frame. Name the properties: transition: transform 200ms, opacity 200ms.display: none to block is not smooth, it just jumps display has no in-between value. Add display 300ms allow-discrete to the transition so none only applies at the end (fade first, then gone), and @starting-style { opacity: 0 } so it can fade in from display: none. The older way: use visibility + opacity.width/left/top stutters Those properties change layout, so every frame the browser recomputes where the element (and its neighbours) go before painting. transform and opacity only change the final picture, so the compositor can do them without a new layout. Slide with transform: translateX().linear, then with ease-out linear = a straight line, the same speed throughout; ease-out is steep at the start and flat at the end.display: none to state B No transitionrun for the changing property: the cloth just vanishes.