![]() |
VOOZH | about |
The CSS transition-duration property specifies how long a transition animation takes to complete when a CSS property changes. It determines the duration of the transition effect from start to finish.
Syntax:
transition-duration: time | initial | inherit;Property Values:
Here are some example discussed:
Example 1: The transition-duration: 5s property smoothly increases the width of the green box from 100px to 300px over 5 seconds when hovered.
Output:
Example 2: The transition-duration: initial property resets the transition duration to its default value (0s), causing the width change to occur instantly when hovered.
Output:
Example 3: The inherit value makes the element inherit the transition-duration from its parent element. If no duration is defined on the parent, the default value (0s) is used.
Output: