Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 transition-property property

CSS3 transition-property Property

Example

Hover over a div element to gradually change the width:

div

{

width:

100

px

;

height:

100

px

;

background:

red

;

transition-property:

width

;

transition-duration:

2

s

; -

webkit-transition-property:

width

;

/*

Safari

*/

webkit-transition-duration:

2

s

;

/*

Safari

*/

}

Try it »

There are more examples at the bottom of this page.


Browser support

The numbers in the table indicate the first browser version that supports this property.

A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.

property
transition-property 26.0
4.0 -webkit- 10.0 16.0
4.0 -moz- 6.1
3.1 -webkit- 12.1
10.5 -o-

Property definition and usage

transition-property is a CSS3 property used to specify which CSS properties a transition applies to. It lets you explicitly name the properties to transition, so that only those properties animate when the element's state changes, rather than all properties.

The value can be a CSS property name or the keyword all, which applies the transition to all properties.

For example, if you only want a transition when the color changes, you can write:



.element {

  transition-property: color;

}

In this way, a transition occurs when the color of the .element changes.

To apply the transition to all properties, use the all keyword:



.element {

  transition-property: all;

}

In this way, a transition occurs whenever any property changes.

You can also specify multiple properties, separated by commas:



.element {

  transition-property: width, height, opacity;

}

In this way, a transition occurs when the width, height, or opacity of the .element changes.

Default value: all
Inherited: no
Version: CSS3
JavaScript syntax: object.style.transitionProperty="width,height"

Syntax

transition-property: none|all|

property

;

Value Description
none No property will receive a transition effect.
all All properties will get a transition effect.
property Defines a comma-separated list of CSS property names to which the transition effect applies.

More examples

Transition effect - changing two properties
Hover over a div element to change its width and height with a smooth transition.