Skip to main content
D
CSS
CSS Animations

CSS Animations

CSS animations move and change elements over time.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

CSS creates smooth, complex animations without needing JavaScript. Developers define a sequence of styles inside keyframes. The browser then automatically calculates the frames needed to transition the element from start to finish.

Example

Example
1/* this spins an element */
2@keyframes spin {
3  from { transform: rotate(0deg); }
4  to { transform: rotate(360deg); }
5}
6
7.loader {
8  animation: spin 2s linear infinite;
9}

Key Points

  • The `@keyframes` rule defines the animation stages.
  • The `animation-name` links the element to the keyframes.
  • The `animation-duration` sets the total runtime.
  • The `animation-iteration-count` makes it loop.

Up Next

Continue your journey with the next topic.

Go to CSS Transitions