This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
transition CSS property is a shorthand property for
transition-delay. It enables you to define the transition between two states of an element. Different states may be defined using pseudo-classes like
- Initial value the concatenation of the initial values of its longhand properties:
- Applies to all elements,
- Inherited no
- Media interactive
- Computed value as each of the properties of the shorthand:
- Animatable no
- Canonical order order of appearance in the formal grammar of the values
/* Apply to 1 property */ /* property name | duration */ transition: margin-left 4s; /* property name | duration | delay */ transition: margin-left 4s 1s; /* property name | duration | timing function | delay */ transition: margin-left 4s ease-in-out 1s; /* Apply to 2 properties */ transition: margin-left 4s, color 1s; /* Apply to all changed properties */ transition: all 0.5s ease-out; /* Global values */ transition: inherit; transition: initial; transition: unset;
Note that order is important within the items in this property: the first value that can be parsed as a time is assigned to the
transition-duration, and the second value that can be parsed as a time is assigned to
See how things are handled when lists of property values aren't the same length. In short, extra transition descriptions beyond the number of properties actually being animated are ignored.
<single-transition-property> = all | IDENT
There are several more examples of CSS transitions included in the main CSS transitions article.
The definition of 'transition' in that specification.
|Working Draft||Initial definition|
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||1.0 -webkit
|4.0 (2.0) -moz
|Feature||Android||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||2.1 -webkit||4.0 (2.0) -moz