English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete list of CSS attributes

CSS3 transition-Usage and examples of the 'delay' property

transition-The 'delay' CSS property defines when the transformation should start (for example, one2The 's' value indicates that the transformation will take effect in the application2seconds after). The value of this attribute can be specified as seconds or milliseconds.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:0s
Applicable to:All elements ::before and ::after Pseudo-element
Inheritance:None
Animatable:No.Please see Animation attributes.
Version: CSS3new feature
JavaScript syntax:object.style.transitionDelay="3s"

transition-The syntax of delay usage

The syntax of this attribute is as follows:

transition-delay: time | initial | inherit

The following example demonstrates how to use transition-delay attribute.

button {
    background: #fd7c2a;
    /* For Safari 3.0+ */
    -webkit-transition-property: background;
    -webkit-transition-duration: 4s;
    -webkit-transition-delay: 2s;
    
    transition-property: background;
    transition-duration: 4s;
    transition-delay: 2s;
}
button:hover {
    background: #3cc16e;
}
Test to see‹/›

Note:This attribute allows negative values. However, it seems to have started in the middle of the transition cycle, for example-2The transition delay of s makes the transition start immediately, but after the transition starts2seconds start.

Attribute value

The following table describes the value of this attribute.

ValueDescription
timeDefine the number of seconds or milliseconds to wait before the transition starts. The default value is 0s.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts its parent element's transition-The value of delay attribute.

Browser compatibility

transition-The compatibility of delay attribute in browsers, the numbers in the following table represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • 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+

For further reading

Please refer to the following tutorials:CSS3 Transitions.

Related attributes:transition,transition-duration,transition-property,transition-timing-function.