CSS transition-property Property
Example
div {
transition-property: width;
transition-duration: 2s;
}
div:hover {
width: 500px;
}
Hover me!
Meaning
The transition-property property sets the CSS properties to which a transition effect should be applied.
Note: The set of properties that can be animated is subject to change. As such, you should avoid including any properties in the list that don't currently animate, as someday they might, causing unexpected results.
Default value: | all |
Inherited: | No |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
transition-property: none|all|property|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
none | No property will get a transition effect. |
all | This is default value. All properties will get a transition effect. |
property | Sets a comma separated list of CSS property names the transition effect is for. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
transition-property: all;
}
More Examples
The following example show how to set all transition properties using shorthand property:
Example
div {
width: 100px;
height: 100px;
background: red;
transition: width 2s ease-in-out 2s;
}
- transition-property: width
- transition-duration: 2s
- transition-timing-function: ease-in-out
- transition-delay: 2s
The following element combines transitions for: border, width, height, background-color, transform. Hover over the red div element to see these properties animated.
Hover me!
Example
div {
border: 1px solid;
width: 100px;
height: 100px;
background-color: red;
transition: border 5s, width 2s, height 2s, background-color 2s, transform 2s;
}
div:hover {
border: 10px solid;
background-color: #0069FF;
width: 200px;
height: 200px;
transform: rotate(180deg);
}