# CSS Transition

> A CSS rule that makes a style change smooth. It runs between two states, like on hover.

**Field:** Design  
**Category:** Motion & Video  
**Also known as:** CSS Transitions, transition Property

## Think of it like

It is like a dimmer switch. The light fades to the new level instead of snapping.

## Definition

A CSS transition makes a style change happen smoothly instead of all at once. You say which property to animate, how long it takes and which easing to use. When the value changes, like on hover, the browser fills in the steps. It only runs from one state to another, so it cannot loop. For more than two states, use a CSS animation.

## Example

Noah moves the mouse over his button. It fades from blue to navy in a fifth of a second.

## Example code

```css
.button {
  background: blue;
  transition: background 200ms ease-out;
}
.button:hover {
  background: navy;
}
```

On hover, the button fades from blue to navy in 200 ms.

## Why it matters

It is the simplest way to add motion to a web page. It needs no script and very little code.

## Common mistake

Moving width or top. Move transform and opacity instead, so it stays smooth on slow phones.

## Three principles

- **Two states.** From one value to another.
- **Property, time, easing.** Three things to set.
- **Animate cheap properties.** Transform and opacity.

## Related terms

- [CSS Animation](https://learn.benibix.com/term/design/css-animation)
- [Easing](https://learn.benibix.com/term/design/easing)
- [Ease-Out](https://learn.benibix.com/term/design/ease-out)
- [Cascading Style Sheets (CSS)](https://learn.benibix.com/term/development/css)
- [Reduced Motion](https://learn.benibix.com/term/design/reduced-motion)

## 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.

![Four small graphs of progress over time. Linear is a straight diagonal line. Ease-in starts flat and ends steep. Ease-out starts steep and ends flat. Ease-in-out is an S-shape, flat at both ends. Under each, a row of dots shows the spacing of the frames.](https://learn.benibix.com/diagrams/easing-curves.svg)

---

Source: https://learn.benibix.com/term/design/css-transition
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.
