English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The transition CSS property allows you to define the transition effect between two states of an element. This istransition-property,transition-duration,transition-timing-functionAndtransition-delayAbbreviated property
The following table provides usage instructions and version history for this property, as well as the syntax for using this property in JavaScript scripts.
Default value: | all 0 ease 0; View all properties |
---|---|
Applies to: | All elements ::before and ::after Pseudo-element |
Inheritance: | None |
Animated production: | No.Please refer to Animation Properties. |
Version: | CSS3new feature |
JavaScript Syntax: | object.style.transition="width 2s" |
The syntax of this attribute is as follows:
transition: transition1 ,[ transition2,…transitionN] | initial | inherit where transition is: [ transition-property | transition-duration | transition-timing-function | transition-delay ]
The following example demonstrates how to use the transition attribute.
button { background: #fd7c2a; -webkit-transition-property: background 2s; /* For Safari 3.0+ */ transition: background 2s; } button:hover { background: #3cc16e; }Test See‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
transition-property | Specify the name of the CSS properties to which the transition effect should be applied. |
transition-duration | Specify the number of seconds or milliseconds required for the transition animation to complete. |
transition-timing-function | Specify how to calculate the intermediate value of the CSS properties affected by the transition. |
transition-delay | Specify when the transition should start. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated elements will adopt the attribute value of the parent element's transition. |
The compatibility of the transition attribute in browsers, the numbers in the following table represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS3 Transitions.
Related Attributes:transition-delay,transition-duration,transition-property,transition-timing-function.