Animation for CSSs
CSS animation adds motion through transitions, which animate a property change between two states, and keyframes, which define multi-step sequences. Transforms such as translate, scale and rotate, and filters like blur, provide effects. Animating transform and opacity performs best because browsers can handle them on the compositor.
Stage: Motion and Effects · Part of the CSS roadmap · Last reviewed 19 November 2026
What to learn in Animation
- Add a hover transition with duration and an easing function
- Write a @keyframes rule and apply it with the animation shorthand
- Combine translate, scale and rotate in a transform
- Apply a blur or brightness filter to an image
- Respect prefers-reduced-motion for users who dislike movement
Animation interview questions
Why animate transform and opacity instead of top and left?
Changing top or left triggers layout recalculation for the page, which is costly. Transform and opacity changes can often be handled by the GPU compositor without layout or paint, so animations stay smooth, especially on low-powered phones.
What is the difference between a transition and a keyframe animation?
A transition runs when a property changes between two states, such as on hover, and has only a start and an end. A keyframe animation can have several steps, run automatically, loop and play without a trigger.
Where Animation fits in the CSS roadmap
Animation belongs to the Motion and Effects stage (beginner level), which takes about 13 hours. Bring it to life.