Compare Two CSS Transition Clocks on One Card
Admin ·
A card can fade as soon as its state changes and begin moving later. Use the two default rows to reproduce the effect, then decide how to trigger it and what the reduced-motion preference will do.
Compare the fade and the delayed movement
Start with the two default rows and select Trigger transition. The opacity starts changing immediately. The transform waits 200 ms before it begins. Both clocks reach their endpoints at 600 ms.
With linear easing, opacity at 300 ms is 0.7, halfway between 1 and 0.4. The transform has traveled one quarter of its 18 px translation, or 4.5 px. Select Return to start, then run the preview again.
| Property | Delay | Duration | Easing |
|---|---|---|---|
| Opacity | 0 ms | 600 ms | Linear |
| Transform | 200 ms | 400 ms | Linear |
CSS Transitions Level 1 properties and transition timingCSS Easing Functions Level 1 cubic Bézier timing
Give one property a different clock
Change the second delay to −100 ms. The transform starts a quarter of the way through its 400 ms clock as soon as the state changes. If both properties should start together, use 0 ms for both delays.
Choose Individual declarations and check each list. Position one represents opacity in property, delay, duration and timing. If you choose a custom curve, keep the two x coordinates between zero and one.
CSS Transitions Level 1 properties and transition timingCSS Easing Functions Level 1 cubic Bézier timing
Apply the CSS and verify the reduced-motion state
Check Preview without motion and trigger the card. It jumps to its end appearance. Keep Respect prefers-reduced-motion selected to export a media query that removes the transition for viewers who request reduced motion.
Use transition-sample as the class in your own page. Toggle data-active to true for the default state-based rule, or export the hover and keyboard focus selectors. Verify the same destination values with the system motion preference on and off.
CSS Media Queries Level 5 prefers-reduced-motionCSS Transitions Level 1 properties and transition timing
Common questions
What starts an exported transition?
The browser starts the clock when a matching property switches between different values. The generated selector includes a different sample value for each selected property.
When is a CSS keyframe animation useful instead?
Use keyframes when the effect needs multiple defined points along a timeline or a repeated sequence. Use a transition when an element changes state.