CSS Animations
CSS
What are CSS Animations?
CSS Animations allow you to move, transform, or change elements over time using keyframes — no JavaScript needed.
- They are more advanced than transition because:
 - They can run automatically
 - They can have multiple steps
 - They can loop infinitely
 
Basic Structure
1. Define the animation
Using @keyframes:
2. Apply the animation to an element
Shorthand Syntax
animation: slideIn 1s ease 0s 1 forwards;
| Property | What it does | 
|---|---|
| animation-name | Name of the keyframes | 
| animation-duration | How long it takes (2s, 500ms) | 
| animation-delay | Wait time before it starts | 
| animation-timing-function | Speed pattern (ease, linear, ease-in-out) | 
| animation-iteration-count | Number of repeats (1, infinite) | 
| animation-direction | normal, reverse, alternate | 
| animation-fill-mode | Keeps final state with forwards or backwards | 
Example: Fade In Animation
Example: Bouncing Box
| Step | Description | 
|---|---|
| @keyframes | Define how the animation behaves | 
| animation | Apply it to the element | 
| Flexible | Supports delays, repeats, directions |