Skip to content
BENIBIX Learn

CSS Transition vs CSS Animation

A transition runs once, from one state to another, like on hover. An animation runs by itself through many steps and can loop.

Design🎞️ Motion & Video

CSS Transition

A CSS rule that makes a style change smooth. It runs between two states, like on hover.

A CSS transition makes a style change happen smoothly instead of all at once. You say which property to animate, how long it takes and which easing to use. When the value changes, like on hover, the browser fills in the steps. It only runs from one state to another, so it cannot loop. For more than two states, use a CSS animation.

Example
Noah moves the mouse over his button. It fades from blue to navy in a fifth of a second.
Why it matters
It is the simplest way to add motion to a web page. It needs no script and very little code.
Full entry
Design🎞️ Motion & Video

CSS Animation

Keyframes written in CSS that the browser plays. It can loop and pass through many steps.

A CSS animation plays a set of keyframes written in CSS. You name the animation with an @keyframes rule and list how things look at points from 0% to 100%. Then you attach it to an element with a duration, an easing and how many times to repeat. Unlike a transition, it can run on its own, loop and pass through many states. It suits spinners, pulses and attention cues.

Example
A loading dot on Emma's site grows and shrinks once a second. It takes a few lines of CSS.
Why it matters
It adds looping motion to a page with no script. The browser runs it smoothly.
Full entry

In one line

CSS Transition
A CSS rule that makes a style change smooth. It runs between two states, like on hover.
CSS Animation
Keyframes written in CSS that the browser plays. It can loop and pass through many steps.