CSS3 transition-delay Property
Example
Wait 2 seconds before the transition starts:
transition-delay: 2s;
-webkit-transition-delay: 2s; /* Safari */
Try it »
Browser support
The numbers in the table indicate the first browser version that supports this property.
A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.
| property | |||||
|---|---|---|---|---|---|
| transition-delay | 26.0 | ||||
| 4.0 -webkit- | 10.0 | 16.0 | |||
| 4.0 -moz- | 6.1 | ||||
| 3.1 -webkit- | 12.1 | ||||
| 10.5 -o- |
Property definition and usage
transition-delay is a CSS3 property used to specify the time before a transition effect starts. It defines the delay after an element's state changes before the transition begins, allowing you to control when the transition starts.
The value can be in seconds (s) or milliseconds (ms), representing the delay time of the transition.
For example, if you want to wait 0.5 seconds after a state change before starting the transition, you can write:
.element {
transition-delay: 0.5s;
}
If you want the transition to start immediately with no delay, set the value to 0:
.element {
transition-delay: 0s;
}
You can also specify different delays for each property. For example, to delay the width transition by 0.3 seconds and the height transition by 0.5 seconds, you can write:
.element {
transition-property: width, height;
transition-delay: 0.3s, 0.5s;
}
In this way, the width transition starts after a 0.3-second wait, and the height transition starts after a 0.5-second wait.
By adjusting the transition-delay property, you can control the delay of transition effects for more precise animations.
| Default value: | 0 |
|---|---|
| Inherited: | no |
| Version: | CSS3 |
| JavaScript syntax: | object.style.transitionDelay="2s" |
Syntax
transition-delay:
time
;
| Value | Description |
|---|---|
| time | Specifies the number of seconds or milliseconds to wait before the transition starts |