transition-duration defaults to 0s, meaning a transition, even with a valid transition-property specified, completes instantly with no visible animation at all unless a nonzero duration is explicitly set — this is one of the most common reasons a transition appears to not be working at all, simply forgetting to specify any duration. Multiple comma-separated duration values can be specified when transition-property lists multiple properties, matching each duration to its corresponding property in the same order they're listed.
1Understanding Transition-duration
transition-duration defaults to 0s, meaning a transition, even with a valid transition-property specified, completes instantly with no visible animation at all unless a nonzero duration is explicitly set — this is one of the most common reasons a transition appears to not be working at all, simply forgetting to specify any duration. Multiple comma-separated duration values can be specified when transition-property lists multiple properties, matching each duration to its corresponding property in the same order they're listed.
A transition with no explicit transition-duration set defaults to 0s, meaning the change happens instantly with zero visible animation — an easy, extremely common oversight when a transition otherwise looks correctly configured but simply appears to do nothing at all.
.box {
transition-property: opacity;
transition-duration: 0.5s;
}2Practical Example
Here is a real-world application of Transition-duration showing how it is used in production CSS code.
.box {
transition-property: opacity;
/* transition-duration omitted, defaults to 0s */
}3Best Practices
Follow these guidelines when working with Transition-duration:
1. Always specify an explicit transition-duration, since its default of 0s produces no visible animation at all even with everything else correctly configured
2. Keep most UI transitions relatively short, typically in the 150ms to 400ms range, since longer durations can start to feel sluggish or unresponsive for everyday interface interactions
3. Match multiple comma-separated duration values to their corresponding properties in the same order when transitioning several different properties with different intended speeds
Tip: A transition with no explicit transition-duration set defaults to 0s, meaning the change happens instantly with zero visible animation — an easy, extremely common oversight when a transition otherwise looks correctly configured but simply appears to do nothing at all.
.box {
transition-property: opacity;
transition-duration: 0.5s;
}