Normally when the value of a CSS property changes, the rendered result is instantly updated. A common example is changing the background color of a button on mouse hover. In a normal scenario the background color of the button is changes immediately from the old property value to the new property value when you place the cursor over the button.
CSS3 introduces a new transition feature that allows you to animate a property from the old value to the new value smoothly over time. The following example will show you how to animate the background-color of an HTML button on mouse hover.
To make the transition occur, you must specify at least two things — the name of the CSS property to which you want to apply the transition effect using the transition-property CSS property, and the duration of the transition effect (greater than 0) using the transition-duration CSS property. However, all the other transition properties are optional, as their default values don't prevent a transition from happening.
Each of the transition properties can take more than one value, separated by commas, which provides an easy way to define multiple transitions at once with different settings.
There are many properties to consider when applying the transitions. However, it is also possible to specify all the transition properties in one single property to shorten the code.
The transition property is a shorthand property for setting all the individual transition properties (i.e., transition-property, transition-duration, transition-timing-function, and transition-delay) at once in the listed order.
It's important to stick to this order for the values, when using this property.
The following table provides a brief overview of all the transition properties: