Course contentsShow
← Web Development
Lesson 506 of 2,9829. CSS Transitions and AnimationsFree lesson

The transition-delay Property

Adding a pause before a transition starts using delay values in seconds or milliseconds.

The transition-delay Property

You'll learn how to add a pause before a CSS transition begins, creating more controlled and polished animation sequences.

What Is transition-delay?

The transition-delay property lets you specify how long the browser should wait before starting a transition. Instead of a change happening immediately when triggered, you can add a deliberate pause.

Think of it like a countdown timer: when you hover over a button, the delay is the "3...2...1..." before the animation actually begins.

How It Works

The syntax is straightforward:

.button {
  background-color: blue;
  transition-property: background-color;
  transition-duration: 0.5s;
  transition-delay: 0.3s; /* Wait 0.3 seconds before starting */
}

.button:hover {
  background-color: green;
}

When you hover over this button, there's a 0.3-second pause, then the background color transitions from blue to green over 0.5 seconds.

Time Values

Just like transition-duration, you specify delays using:

  • Seconds: 2s, 0.5s
  • Milliseconds: 300ms, 150ms

A delay of 0s (the default) means the transition starts immediately.

Why Use Delays?

Delays help you:

  • Stagger animations when multiple elements transition at once
  • Prevent accidental triggers (users brushing past a hover area)
  • Create choreographed sequences where one change follows another
.card {
  transition-property: transform, opacity;
  transition-duration: 0.4s, 0.4s;
  transition-delay: 0s, 0.2s; /* Opacity waits 0.2s */
}

Key Takeaway: The transition-delay property adds a waiting period before a transition begins, measured in seconds (s) or milliseconds (ms), giving you fine-grained control over animation timing.