# CSS Animation

> Keyframes written in CSS that the browser plays. It can loop and pass through many steps.

**Field:** Design  
**Category:** Motion & Video  
**Also known as:** CSS Keyframes, @keyframes, CSS Animations

## Think of it like

It is like a dance routine written on a card. The browser reads the steps and plays them on its own.

## Definition

A CSS animation plays a set of keyframes written in CSS. You name the animation with an @keyframes rule and list how things look at points from 0% to 100%. Then you attach it to an element with a duration, an easing and how many times to repeat. Unlike a transition, it can run on its own, loop and pass through many states. It suits spinners, pulses and attention cues.

## Example

A loading dot on Emma's site grows and shrinks once a second. It takes a few lines of CSS.

## Example code

```css
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}
.dot {
  animation: pulse 1s ease-in-out infinite;
}
```

The dot grows and shrinks every second, on a loop.

## Why it matters

It adds looping motion to a page with no script. The browser runs it smoothly.

## Common mistake

A loop next to text people are reading. Motion that never ends pulls the eye away.

## Three principles

- **Keyframes in CSS.** From 0% to 100%.
- **Runs on its own.** No hover needed.
- **Can loop.** Set how many times.

## Related terms

- [CSS Transition](https://learn.benibix.com/term/design/css-transition)
- [Keyframe](https://learn.benibix.com/term/design/keyframe)
- [Ease-In-Out](https://learn.benibix.com/term/design/ease-in-out)
- [Cascading Style Sheets (CSS)](https://learn.benibix.com/term/development/css)
- [Reduced Motion](https://learn.benibix.com/term/design/reduced-motion)
- [GreenSock Animation Platform (GSAP)](https://learn.benibix.com/term/development/gsap)

## Told apart from

- [CSS Transition vs CSS Animation](https://learn.benibix.com/compare/css-transition-vs-css-animation): A transition runs once, from one state to another, like on hover. An animation runs by itself through many steps and can loop.

![A timeline with two diamond keyframes, one at frame 0 and one at frame 24. Above it, a ball travels along a curved path from the first spot to the second. Faded copies of the ball between them are the frames the computer fills in.](https://learn.benibix.com/diagrams/keyframes-tweening.svg)

---

Source: https://learn.benibix.com/term/design/css-animation
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
