animation-name
Example
.badge {
animation-name: Pop;
animation-duration: 0.3s;
}
@keyframes pop {
from { scale: 0.8; }
}.badge {
animation-name: pop;
animation-duration: 0.3s;
}
@keyframes pop {
from { scale: 0.8; }
}Keyframe names are case-sensitive, so 'Pop' doesn't match @keyframes pop.
Common mistakes
- A typo in the name makes the animation silently do nothing.
- Two
@keyframesrules share one name, and only the last one is used.
Key points
- Every name matches a defined
@keyframesrule exactly, including letter case. - Names are specific, like 'fade-in-up', so they don't collide with keyframes from other stylesheets.
Interview questions
What happens if animation-name doesn't match any @keyframes?
No animation runs and no error is shown, so the element keeps its normal styles.
Can I list several animation names?
Yes. Separate names with commas; the other animation longhands map to them by position.