DigitalOcean provides cloud products for every stage of your journey. Get started with $200 in free credit!
The transition-delay
property, normally used as part of transition
shorthand, is used to define a length of time to delay the start of a transition.
.delay-me {
transition-delay: 0.25s;
}
The value can be one of the following:
- A valid time value defined in seconds or milliseconds e.g.
1.3s
or125ms
- A comma-separated list of time values, for defining separate delay values on multiple transitions for a single element e.g.
1s background-color, 350ms transform
The default value for transition-delay
is 0s
, meaning that no delay will take place and the transition will start to occur immediately. The time value can be expressed as a decimal-based number for more precise timing.
When a transition has a delay value that is negative, it will cause the transition to begin immediately (with no delay), however, the transition will begin partway through the process, as though it had already begun.
The following Pen shows a hover effect on a box that uses a transition-delay
value of 2s
with a transition duration of 1s
:
See the Pen
Transition delay demo by CSS-Tricks (@css-tricks)
on CodePen.
Now compare that to the following demo, which has a delay of -1s
and a duration of 3s
:
See the Pen
Negative transition delay demo by CSS-Tricks (@css-tricks)
on CodePen.
Notice that in the second example, only the final two-thirds of the actual transition are visible and there is no delay. The negative value removes the delay and effectively cuts into the duration.
For compatibility in all supporting browsers, vendor prefixes are required, with the standard syntax declared last:
.example {
-webkit-transition-delay: 500ms;
-moz-transition-delay: 500ms;
-o-transition-delay: 500ms;
transition-delay: 500ms;
}
IE10 (the first stable version of IE to support transition-delay
) does not require the -ms-
prefix.
A common use case is stagging transitions:
See the Pen
Staggered Animations by Chris Coyier (@chriscoyier)
on CodePen.
Related Properties
Other Resources
- transition-delay on W3C
- transition-delay on MDN
- Maintaining CSS Style States using “Infinite” Transition Delays
Browser Support
This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.
Desktop
Chrome | Firefox | IE | Edge | Safari |
---|---|---|---|---|
4* | 5* | 10 | 12 | 5.1* |
Mobile / Tablet
Android Chrome | Android Firefox | Android | iOS Safari |
---|---|---|---|
126 | 127 | 2.1* | 6.0-6.1* |