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

CSS3 transition-duration Property

Topic: CSS3 Properties Reference« Prev|Next »

Description

The transition-duration CSS property specifies the number of seconds (s) or milliseconds (ms) a transition animation should take to complete.

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

Default value: 0s
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-duration: 
time | initial | inherit

The example below shows the transition-duration property in action.

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

Property Values

The following table describes the values of this property.

Value Description
time Specifies the duration that a transition should take to complete. The default value is 0s. Negative values are invalid.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element transition-duration property.

Browser Compatibility

The transition-duration property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 5+ -moz-, 15+
  • Google Chrome 4+ -webkit-
  • Internet Explorer 10+
  • Apple Safari 4+ -webkit-
  • Opera 12+ -o-, 15+ -webkit-

Further Reading

See tutorial on: CSS3 Transitions.

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

 
Close

Your Feedback:

 

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