Animation Shorthand Property

Last updated: 2026-09-13

animation Animation Shorthand Property

The animation property is a shorthand for animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, and animation-play-state. Combined with @keyframes, it defines multi-stage, looping, pausable animation sequences. Unlike transition, animation plays automatically with no trigger, making it ideal for loaders, carousels, breathing effects, and other continuous visuals.

Category
Initial Valuenone
InheritedNo
Applies Toall
Animation Typediscrete
CSS VersionCSS3
StatusStandard

📝 Syntax

animation: [ none | <single-animation> ]#;
/* <single-animation> = <time> || <easing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ] */

⚙️ Values

ValueTypeDescription
<single-animation>#ValueAnimation shorthand: name, duration, timing function, delay, iteration count, direction, fill mode, play state

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
animation v43 v12 v16 v9 v30
Supported in all major browsers
Tip: The order of the values is not significant, but the first value that parses as a time is the duration and the second is the delay. Avoid a keyframe name that collides with a keyword.
Important: If the animation shorthand does not include an animation-name, the whole declaration is invalid. It is generally recommended to include the name inside the shorthand to make sure the animation actually runs.

❓ FAQ

QCan a CSS animation be paused mid-way and then resumed again?
AYes. Set animation-play-state: paused to pause and running to resume. The most common pattern is pairing it with :hover so the animation pauses while the mouse is over the element. While paused, the animation stays on its current frame, and when resumed it continues from exactly where it left off.
QHow do I make an animation play once and stop on the last frame?
AUse animation-fill-mode: forwards, which keeps the element at its final keyframe after the animation ends, and set animation-iteration-count to 1. If you also want the element to hold its initial state before the animation starts, use animation-fill-mode: both. This is the standard way to run a one-shot entrance or reveal animation.
QIn the animation shorthand, which time is duration and which is delay?
AThe first value that parses as a time is the duration and the second is the delay. In animation: bounce 1.5s 0.5s ease, 1.5s is the playback duration and the animation starts after a 0.5s delay. When only one time is given, it is the duration and the delay defaults to 0s. Mixing these two times up is the most common shorthand mistake.
QMy CSS animation is choppy and drops frames. How do I make it smoother?
AAnimate only transform and opacity, and avoid animating width, height, filter, or other properties that force reflow and repaint on every frame. Add will-change to the animated element so a compositor layer is created in advance, and use absolute positioning to take it out of the document flow. A negative animation-delay skips the beginning and jumps straight into the middle.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏