The animation property is a shorthand that applies CSS animations in one line. You define motion with @keyframes, then use animation to set name, duration, timing, and more.
01
Shorthand
One line, many settings.
02
@keyframes
Define animation steps.
03
Syntax Order
Name, duration, timing…
04
Duration
How long it runs.
05
Timing & Delay
Speed curve and wait time.
06
Repeat & Direction
Loop and playback control.
Fundamentals
Definition and Usage
The animation CSS property is a shorthand for animation-related longhand properties. Instead of writing animation-name, animation-duration, and several others separately, you can combine them into one declaration.
Animations always need two parts: first define the keyframe steps with @keyframes, then apply them with animation. This makes it easier to create loaders, entrances, hover effects, and other dynamic UI motion.
💡
Beginner Tip
A minimal working animation usually needs at least a keyframe name and a duration, for example animation: fadeIn 1s;.
Foundation
📝 Syntax
The animation shorthand accepts multiple values in a specific order:
syntax.css
selector{animation:name duration timing-function delay iteration-count direction fill-mode play-state;}
Use shorthand for brevity and longhand when you need to override one animation setting later.
🧠 How the animation Property Works
1
Define @keyframes
Write the animation steps under a custom name such as fadeIn or slideUp.
Define
2
Apply the shorthand
Set animation: fadeIn 1s ease-out; on the element you want to animate.
Apply
3
Browser runs the cycle
The browser interpolates property values over the duration using your timing function and repeat settings.
Animate
=
🎬
Animated UI
Elements move, fade, scale, or change color based on your keyframes and shorthand settings.
Compatibility
Universal Browser Support
The animation shorthand is supported in all modern browsers alongside @keyframes.
✓ Baseline · CSS Animations
Create animations in modern browsers
Chrome, Firefox, Safari, Edge, and Opera all support the animation shorthand and keyframe animations.
98%Modern browser support
Google Chrome43+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera30+ · Modern versions
Full support
Legacy browsers
Very old browsers without CSS animation support cannot use the animation shorthand.
💻
Internet ExplorerIE 9 and earlier · No CSS animation support
None
animation property98% supported
Bottom line: Define clear keyframes and pair them with a duration in the animation shorthand for reliable results.
Wrap Up
Conclusion
The animation property is the fastest way to apply CSS animations. Define your keyframes once, then use the shorthand to set duration, timing, delay, repetition, and direction.
Start with simple values like animation: fadeIn 1s;, then expand to fuller declarations such as animation: moveAndColor 3s ease-in-out 1s infinite alternate; as your effects become more advanced.
Prefer transform and opacity for smooth performance
Respect prefers-reduced-motion for accessibility
❌ Don’t
Forget to create matching @keyframes before applying animation
Put duration before the animation name
Animate too many properties at once without testing performance
Rely on animation alone for essential content visibility
Use overly long infinite animations that distract users
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about the animation property
Use these points when writing CSS animations.
5
Core concepts
⚡01
Shorthand
Sets many animation properties at once.
Purpose
📝02
Needs @keyframes
Define steps before applying.
Rule
⏱️03
Name + Duration
Minimum for visible motion.
Syntax
🔀04
Order Matters
Duration follows the name.
Rule
📈05
Multiple Values
Comma lists run several animations.
Pattern
❓ Frequently Asked Questions
The animation property is a shorthand that sets multiple animation-related properties in one declaration, including name, duration, timing function, delay, iteration count, direction, fill mode, and play state.
The initial value is equivalent to animation: none 0s ease 0s 1 normal none running, which means no animation runs until you assign keyframes and a duration.
Yes. The animation shorthand applies an animation to an element, but you must define the keyframe steps separately with @keyframes unless you use animation: none.
The usual order is name, duration, timing-function, delay, iteration-count, direction, fill-mode, and play-state. Duration must come immediately after the name when both are present.
Yes. You can list multiple comma-separated animation values, and each group pairs with the corresponding keyframe name and settings in the same order.