CSS propertyAnimations

animation-delay

Sets how long to wait before the animation starts.

Initial value
0s
Inherited
No
Animatable
no
Applies to
all elements and the ::before and ::after pseudo-elements
JavaScript
element.style.animationDelay = "0.3s"
On this page

Example

#
CSS
.list li {
  animation: fade-up 0.5s ease-out both;
}

.list li:nth-child(2) { animation-delay: 0.1s; }
.list li:nth-child(3) { animation-delay: 0.2s; }
Preview

Definition and usage

#

The animation-delay property delays the start of the animation. During the delay the element looks as if there were no animation, unless animation-fill-mode is set to backwards or both.

Different delays for consecutive elements are a simple way to create a cascade effect, for example loading-indicator dots that pulse one after another.

A negative value makes the animation start immediately, but as if it had already been running for some time. It helps when the looping animations of many elements should not start at the same point.

Syntax

#
Syntax
animation-delay: <time> [, <time>]*;

Values

#
  • 0s

    All the dots bounce together.
  • cascade

    0s, 0.15s, 0.3s

    Each following dot starts a little later.
  • -0.6s

    negative value

    The middle dot starts halfway through the cycle.

Values in practice

#

0s

All the dots bounce together.
.dot { animation-delay: 0s; }

cascade

Each following dot starts a little later.
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

-0.6s

The middle dot starts halfway through the cycle.
.demo { animation-delay: -0.6s; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • For delayed entrance animations, set animation-fill-mode: both so the element does not flash before the start.
  • Keep cascades short, 50-100 ms between elements. Waiting a long time for the last element is tiring.

Related entries

#

Practise it in lessons

#

Spotted a mistake or missing an example? Write to us.