CSS animation-delay Property
The animation-delay property specifies how long an animation waits before starting or how far into its progress it begins.
It accepts positive, zero, and negative time values. Positive values postpone an animation, while negative values cause it to begin immediately at a later point in its timeline. This property is useful for staggered effects, coordinated animations, and controlling when keyframe animations become visible.
animation-delay Syntax
selector {
animation-delay: 2s;
}
The value specifies a time in seconds (s) or milliseconds (ms). The time unit is required, including for zero.
.immediate {
animation-delay: 0s;
}
.delayed {
animation-delay: 1500ms;
}
.advanced {
animation-delay: -1s;
}
For multiple animations, specify a comma-separated list of delay values.
.multiple {
animation-delay: 1s, 2s, 500ms;
}
The property also accepts the global CSS values inherit, initial, revert, revert-layer, and unset.
Property Values
| Value | Description |
|---|---|
0s |
Starts the animation without an initial delay. This is the initial value. |
2s |
Waits two seconds before the animation begins. |
500ms |
Waits 500 milliseconds, equivalent to half a second. |
-1s |
Starts immediately, as though one second of animation time has already elapsed. |
1s, 2s |
Assigns separate delays to multiple animations in their listed order. |
Values use the CSS <time> data type. Positive and negative values are permitted, but a unitless number such as 2 is invalid.
The property applies to all elements, is not inherited, and has an initial value of 0s. Its computed value is a list of time values, and the property itself is not animatable.
How animation-delay Works
When an animation is applied to an element, the browser uses animation-delay to determine when the animation enters its active period.
The delay is measured from when the animation is applied, not necessarily from when the page finishes loading.
.box {
animation-name: fade-in;
animation-duration: 2s;
animation-delay: 1s;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
In this example, the animation waits one second and then progresses from transparent to fully visible over two seconds.
Without an appropriate animation-fill-mode, the element uses its normal CSS styles during the waiting period. The delay does not automatically apply the first keyframe's styles.
For an animation with multiple iterations, the initial delay is applied once when the animation starts, not before every iteration.
Positive and Negative Delays
Positive and negative delay values affect animation playback differently.
Positive Delays
A positive value postpones the beginning of an animation.
.box {
animation: move 3s linear forwards;
animation-delay: 2s;
}
The element waits two seconds before beginning the three-second animation. Its total time from application to completion is five seconds.
Negative Delays
A negative value makes an animation begin immediately, but at a point that is already partway through its progress.
.box {
animation: move 3s linear forwards;
animation-delay: -1s;
}
Here, the animation begins as though one second has already elapsed. With a three-second duration and one iteration, approximately two seconds of active animation remain.
A negative delay does not make the animation run faster. It changes the starting point in the animation timeline.
If the negative delay is large enough to cover the entire active duration of a finite animation, the animation may already be finished when it is applied. Its visible result then depends on its fill mode.
Delays and animation-fill-mode
The animation-fill-mode property controls whether keyframe styles apply outside an animation's active period.
This is particularly important when an animation has a positive delay.
.box {
animation-name: fade-in;
animation-duration: 2s;
animation-delay: 1s;
animation-fill-mode: backwards;
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
With backwards, the first relevant keyframe styles apply during the one-second waiting period. In this example, the element remains transparent until the animation begins.
| Fill Mode | Effect During or After a Delay |
|---|---|
none |
Does not preserve keyframe styles before or after the active animation period. |
backwards |
Applies the appropriate starting keyframe styles during a positive delay. |
forwards |
Retains the appropriate ending keyframe styles after the animation finishes. |
both |
Combines the behavior of backwards and forwards. |
Use backwards or both when an element needs to display its starting animation state while waiting for a delayed animation.
Multiple Animation Delays
When an element runs several animations, you can assign a separate delay to each one.
.box {
animation-name: fade-in, slide-in;
animation-duration: 2s, 3s;
animation-delay: 0s, 1s;
}
The fade-in animation begins immediately, while slide-in begins after one second.
Delay values are matched to animations in the order specified by animation-name.
If the delay list contains fewer values than the animation list, the browser repeats the delay values as needed.
.box {
animation-name: fade, move, rotate;
animation-delay: 0s, 1s;
}
In this example, fade uses 0s, move uses 1s, and rotate uses 0s.
This behavior makes it possible to coordinate several effects without writing separate declarations for every animation.
animation-delay Example
The following example compares three identical animations with different delays. The first begins immediately, the second waits one second, and the third begins one second into its animation.
<div class="delay-demo">
<div class="delay-row">
<strong>0s</strong>
<div class="delay-track"><div class="delay-box immediate"></div></div>
</div>
<div class="delay-row">
<strong>1s</strong>
<div class="delay-track"><div class="delay-box delayed"></div></div>
</div>
<div class="delay-row">
<strong>-1s</strong>
<div class="delay-track"><div class="delay-box advanced"></div></div>
</div>
</div>
.delay-demo {
display: grid;
gap: 12px;
}
.delay-row {
display: flex;
align-items: center;
gap: 12px;
}
.delay-row strong {
flex: 0 0 35px;
}
.delay-track {
flex: 1;
min-width: 0;
height: 40px;
padding: 5px;
background-color: #f1f3f5;
border: 1px solid #ccc;
box-sizing: border-box;
}
.delay-box {
width: 30px;
height: 28px;
background-color: #1769aa;
animation-name: delay-move;
animation-duration: 3s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-direction: alternate;
}
.delay-box.immediate {
animation-delay: 0s;
}
.delay-box.delayed {
animation-delay: 1s;
}
.delay-box.advanced {
animation-delay: -1s;
}
@keyframes delay-move {
from {
transform: translateX(0);
}
to {
transform: translateX(100px);
}
}
@media (prefers-reduced-motion: reduce) {
.delay-box {
animation: none;
}
}
Each box moves the same distance with the same timing function. Only the delay changes, allowing you to compare how the animation starts.
The first box starts at the beginning of its animation. The second initially waits, and the third starts at a more advanced position. Because the animations repeat indefinitely, the positive delay occurs only once, not at the beginning of each cycle.
If reduced motion is enabled, the boxes remain stationary.
Using the animation Shorthand
The animation-delay property can be specified separately or included in the animation shorthand.
For example, these declarations:
.box {
animation-name: fade-in;
animation-duration: 2s;
animation-timing-function: ease;
animation-delay: 1s;
}
Can be written as:
.box {
animation: fade-in 2s ease 1s;
}
When two time values appear in the shorthand, the first represents animation-duration and the second represents animation-delay.
If only one time value is supplied, it represents the duration, and the delay remains at its initial value of 0s.
Declaring the animation shorthand after an animation-delay declaration can reset the delay. Place the longhand declaration afterward if it needs to override the shorthand.
Important Considerations
Keep the following points in mind when using animation-delay:
- Time units: Specify seconds or milliseconds. Unitless values, including
0, are invalid. - Negative values: Negative delays advance the animation's starting position rather than increasing its playback speed.
- Repeated animations: The initial delay is applied once, not before each iteration.
- Fill modes: Use
animation-fill-modeto control which keyframe styles apply during a positive delay or after an animation finishes. - Paused animations: If an animation is paused during its delay, the delay countdown pauses until playback resumes.
- Scroll-driven animations: The traditional
animation-delayproperty does not delay progress on scroll-driven animation timelines. - Accessibility: Respect
prefers-reduced-motionfor animations that involve significant movement.
For interfaces with several animated elements, staggered delays can create a sequence of effects. Avoid delays that unnecessarily prevent users from accessing important content or controls.
Browser Support
The animation-delay property has Baseline Widely available status and has been supported across major browser engines since September 2015, including Chrome, Edge, Firefox, and Safari.
Basic positive, zero, negative, and comma-separated delay values are broadly supported. Newer animation timing features may have different compatibility requirements.
Visit Can I Use? to check current browser compatibility.
Specifications
The animation-delay property is defined in the CSS Animations Level 1 specification, with further development in CSS Animations Level 2.
