Understand the idea
A transition can make a state change easier to follow. Movement should support an interaction rather than become a requirement for understanding the page.
Transition specific properties instead of using all. Keep durations short. prefers-reduced-motion detects a user preference for less motion; provide a calm alternative that still communicates focus and state.
Read the example
This is a CSS fragment. Put it in a stylesheet and supply the matching HTML described in the exercise.
.card { transition: transform 160ms ease; }
.card:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) {
.card { transition: none; }
.card:hover { transform: none; }
}A small mistake, explained
What goes wrong
Hiding content until an animation completes can leave it unavailable if the animation or script does not run.
How to fix it. Make content visible by default. Enhance the interaction without making movement a prerequisite.
Try it yourself
Turn on reduced motion in your operating system or browser developer tools. Check that content and controls still work.
Further reading
W3C — prefers-reduced-motion (new tab)
Keep exploring
- CSS · Guide
Find the source of horizontal overflowFix the oversized element instead of hiding the symptom.
- CSS · Guide
Why a huge z-index can still loseUnderstand the group an element belongs to before raising its number.