CSS Transition Not Animating
Quick summary
Your transition is not working because the property is not transitionable, the duration is missing, or the value change is not triggered.
Why this happens
The transition property is misspelled or not animatable (e.g., display)
Missing duration value (defaults to 0s — no animation)
The property value does not actually change between states
The transition is defined on the wrong element or state
Minimal example
/* Missing duration — defaults to 0s */
.box { transition: background; }
.box:hover { background: red; }
/* display is not animatable */
.box { transition: display 0.3s; }/* Transition on base element with duration */
.box {
background: blue;
transition: background 0.3s ease;
}
.box:hover { background: red; }Add a duration (0.3s) to the transition. Define the transition on the base .box rule, not on :hover. Use animatable properties like background, not display.
How to diagnose
Check the transition shorthand — is a duration specified?
Verify the property is animatable (not all properties can transition)
Inspect DevTools to see if the property value changes between states
Ensure the transition is on the base element, not just the :hover state
How to fix
Specify a duration: transition: color 0.3s ease
Use an animatable property (color, opacity, transform, width, etc.)
Define the transition on the base element, not the pseudo-class
Use transform and opacity for best performance
How to prevent
Always include a duration in transition declarations
Prefer transform and opacity for smooth 60fps animations
Test transitions by toggling the state in DevTools
Related Resources
Related Glossary
Related Lessons
- CSS Animations
Learn CSS animations.