CSS animation Property
Description
The CSS animation property is a powerful shorthand that allows you to apply complex, timeline-based animations to elements using pure CSS. It works by linking an element to a set of keyframes and controlling how that animation behaves over time. Instead of relying on JavaScript for motion effects, CSS animations let the browser handle transitions smoothly and efficiently, resulting in better performance and cleaner code. Animations can run automatically, repeat infinitely, pause, reverse direction, or even maintain their final visual state after completion.
At its core, the animation property combines several individual animation-related properties into a single declaration. These include the animation’s name (which connects it to a @keyframes rule), its duration, timing behavior, delay before starting, repetition count, direction, fill behavior, and play state. For example, duration defines how long an animation takes to complete, while timing functions control the pacing of movement - whether it’s linear, eased, or custom. These underlying controls are also available individually, such as animation-duration and animation-timing-function, allowing for more granular control when needed.
One of the most powerful aspects of CSS animations is how naturally they integrate with other CSS features. Animations can affect visual properties such as position, opacity, transforms, and colors without disrupting layout flow. When paired with properties like transform or opacity, animations can appear smooth and hardware-accelerated, making them ideal for modern UI effects such as loaders, hover feedback, attention cues, and micro-interactions. Unlike transitions, animations don’t require a state change to run - they can start automatically and loop continuously if desired.
Finally, the animation property helps keep stylesheets clean and maintainable by grouping multiple animation controls into a single line. This not only improves readability but also makes it easier to reuse animations across elements or projects. When combined with well-structured keyframes and thoughtful timing, CSS animations can significantly enhance user experience without sacrificing performance or accessibility.
Definition
- Initial value
- see individual properties
- Applies to
- All elements, ::before and ::after pseudo elements
- Inherited
- See individual properties
- Computed value
- See individual properties
- Animatable
- No
- JavaScript syntax
- object.style.animation
Interactive Demo
Syntax
animation: <single-animation> [ ',' <single-animation> ]*
Values
- <animation-name>See animation-name CSS property for values.
- <animation-duration>See animation-duration CSS property for values.
- <animation-timing-function>See animation-timing-function CSS property for values.
- <animation-delay>See animation-delay CSS property for values.
- <animation-iteration-count>See animation-iteration-count CSS property for values.
- <animation-direction>See animation-direction CSS property for values.
- <animation-fill-mode>See animation-fill-mode CSS property for values.
- <animation-play-state>See animation-play-state CSS property for values.
Example
Browser Support
The following information will show you the current browser support for the CSS animation property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
