Skip to content
Web Design & Development

How to Get CSS Transitions and Animations Right

Native CSS tools for animating changes between states, using transitions for simple state changes and keyframe animations for more complex motion.

MediaScaleUp Editorial Team 2 min read 14 views
How to Get CSS Transitions and Animations Right

Where most projects go wrong

The usual mistakes:

  • Animating layout properties such as width and top
  • Long decorative animations on interactions
  • Ignoring reduced-motion settings
  • Many simultaneous animations

What good looks like instead

  • Animate transform and opacity where possible
  • Keep interface transitions short
  • Respect reduced-motion preferences
  • Use consistent easing tokens
  • Test on lower-powered devices
What to do and what to avoid with CSS transitions and animations, side by side
Good practice against the usual mistakes, from the sources listed below.

Why it matters

CSS animation is efficient and declarative, and animating the right properties keeps interfaces smooth.

The specs that matter

Published figures for CSS Transitions and Animations
MeasureFigure
Transitionsanimate between two states when a property changes
Keyframe animationsdefine multi-step motion with @keyframes
Efficient propertiestransform and opacity can often run on the compositor
Reduced motionthe prefers-reduced-motion media query

Knowing when to hand it over

Tip: Bring in help when animations cause jank or accessibility complaints.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development