What is the difference between CSS transition and animation?
A transition needs a trigger (like :hover) and goes from one state to another. An animation uses @keyframes, can have many steps, can repeat, and can start by itself.
| Point | Transition | Animation |
|---|---|---|
| Needs trigger | Yes | No |
| Steps | Two (start and end) | Many (keyframes) |
| Repeat | No | Yes, with infinite |
See Transitions and Animations.
Learn more about the similar topics:
| Tutorials |
|---|
| CSS Shadows |
| CSS Opacity / Transparency |
| CSS Transitions and Animations |
| Exercises & Assignments |
|---|
| Write CSS to create a card with box shadow and gradient background |
| Write CSS to create a pulsing animation |
| Interview Questions & Answers |
|---|
| What is the difference between CSS transition and animation? |