The CSS animations module lets you animate the values of CSS properties, such as background-position and transform, over time by using keyframes. Each keyframe describes how the animated element should render at a given time during the animation sequence. You can use the properties in the animations module to control the duration, number of repetitions, delayed start, and other aspects of an animation.
To view the animation in the box below, click the checkbox 'Play the animation' or hover the cursor over the box. When the animating is active, the cloud at the top changes shape, snowflakes fall, and the snow level at the bottom rises. To pause the animation, uncheck the checkbox or move your cursor away from the box.
This sample animation uses animation-iteration-count to make the flakes fall repeatedly, animation-direction to make the cloud move back and forth, animation-fill-mode to raise the snow level in response to the cloud movement, and animation-play-state to pause the animation.
Click "Play" in the example above to see or edit the code for the animation in the MDN Playground.
animation shorthandanimation-compositionanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timelineanimation-timing-functionThe CSS animations module level 2 also introduces the animation-trigger, animation-trigger-exit-range, animation-trigger-exit-range-end, animation-trigger-exit-range-start, animation-trigger-range, animation-trigger-range-end, animation-trigger-range-start, animation-trigger-timeline, and animation-trigger-type properties. Currently, no browsers support these features.
All animations, even those with 0 seconds duration, throw animation events.
Step-by-step tutorial on how to create animations using CSS. This article describes the animation-related CSS properties and at-rule and how they interact with each other.
Common animation requirements that can be solved with a few lines of JavaScript.
will-change CSS property<easing-function> data typeprefers-reduced-motion media query| Specification |
|---|
| CSS Animations Level 2> |
| CSS Animations Level 1> |
interpolate-size property and calc-size() function for enabling animations to and from intrinsic size values.<canvas> HTML element along with canvas API and WebGL API to draw graphics and animations.SVGAnimationElement interface for all the animation-related element interfaces, including SVGAnimateElement, SVGSetElement, SVGAnimateColorElement, SVGAnimateMotionElement, and SVGAnimateTransformElement.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations