CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS3 transition Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The transition CSS property allows you to define the transition between two states of an element. It is a shorthand property for transition-property, transition-duration, transition-timing-function and transition-delay.

The following table summarizes the usages context and the version history of this property.

Default value: all 0 ease 0; See individual properties
Applies to: All elements, ::before and ::after pseudo-elements
Inherited: No
Animatable: No. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

transition: 
transition1 [, transition2, ... transitionN] | initial | inherit
where transition is: [ transition-property | transition-duration | transition-timing-function | transition-delay ]

The example below shows the transition property in action.

  • button {
  •     background: #fd7c2a;
  •     -webkit-transition-property: background 2s; /* For Safari 3.0+ */
  •     transition: background 2s; /* Standard syntax */
  • }
  • button:hover {
  •     background: #3cc16e;
  • }

Property Values

The following table describes the values of this property.

Value Description
transition-property Specifies the names of the CSS properties to which a transition effect should be applied.
transition-duration Specifies the number of seconds or milliseconds a transition animation should take to complete.
transition-timing-function Specifies how the intermediate values of the CSS properties being affected by a transition will be calculated.
transition-delay Specifies when the transition will start.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element transition property.

Browser Compatibility

The transition property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 4+ -moz-, 16+
  • Google Chrome 4+ -webkit-, 26+
  • Internet Explorer 10+
  • Apple Safari 3.1+ -webkit-, 6.1+
  • Opera 10.5+ -o-, 12.1+

Further Reading

See tutorial on: CSS3 Transitions.

Related properties: transition-delay, transition-duration, transition-property, transition-timing-function.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.