CSS transition-delay Property
The CSS transition-delay property specifies how long the browser waits before starting a CSS transition after an eligible property value changes.
Transition delays can be positive, zero, or negative. Positive values postpone the start of a transition, zero starts it without a delay, and negative values make the transition begin as though part of its duration has already elapsed. The property also accepts comma-separated values for multiple transitions.
transition-delay Syntax
The transition-delay property accepts one or more CSS time values. Each value can use seconds (s) or milliseconds (ms).
Basic Syntax
.example {
transition-delay: 0.5s;
}
Using Seconds
.example {
transition-delay: 1s;
}
Using Milliseconds
.example {
transition-delay: 250ms;
}
Zero Delay
.example {
transition-delay: 0s;
}
Negative Delay
.example {
transition-delay: -0.3s;
}
Multiple Delays
.example {
transition-delay: 0s, 0.2s, 0.5s;
}
CSS-Wide Keywords
.example {
transition-delay: initial;
}
.example {
transition-delay: inherit;
}
.example {
transition-delay: unset;
}
.example {
transition-delay: revert;
}
.example {
transition-delay: revert-layer;
}
Invalid Examples
.example {
transition-delay: 300;
}
.example {
transition-delay: 50%;
}
.example {
transition-delay: 2px;
}
.example {
transition-delay: 0.2s 0.5s;
}
Transition delays require valid time values. Percentages, lengths, and unitless nonzero numbers are invalid. Multiple values must be separated by commas.
Property Values
| Value | Description |
|---|---|
0s |
Starts the transition without a delay. This is the default. |
0.5s |
Waits half a second before beginning the transition. |
250ms |
Waits 250 milliseconds before beginning the transition. |
-0.2s |
Starts the transition as though 0.2 seconds have already elapsed. |
0s, 0.3s |
Defines separate delays for multiple transition properties. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | 0s |
| Inherited | No |
| Applies to | All elements, including ::before and ::after |
| Computed value | As specified |
| Animation type | Not animatable |
| Percentages | Not accepted |
| Negative values | Allowed |
| Specification | CSS Transitions Level 1 |
Note: The transition-delay property is a longhand component of the transition shorthand. It controls when a transition begins, not how long the transition lasts.
How It Works
A transition delay is measured from the moment an eligible property value change triggers a transition.
Step 1: Define the Initial Style
.button {
background-color: #2563eb;
}
Step 2: Add a Transition Duration
.button {
transition-property: background-color;
transition-duration: 0.4s;
}
Step 3: Add a Delay
.button {
transition-delay: 0.5s;
}
Step 4: Change the Property on Hover
.button:hover {
background-color: #1e40af;
}
Understanding the Timing
When the pointer enters the button, the browser waits 0.5 seconds before starting the 0.4-second background color transition.
| Time | Behavior |
|---|---|
| 0 seconds | The hover state begins. |
| 0 to 0.5 seconds | The transition waits during its delay. |
| 0.5 seconds | The color transition begins. |
| 0.9 seconds | The transition finishes, assuming the hover state remains active. |
Important Consideration
If the property changes again before the delay finishes, the pending transition may be canceled or replaced. The browser does not necessarily complete every scheduled transition.
Positive Transition Delays
A positive transition-delay postpones the start of a transition.
Short Delay
.example {
transition: opacity 0.3s ease;
transition-delay: 0.1s;
}
Half-Second Delay
.example {
transition: transform 0.4s ease;
transition-delay: 0.5s;
}
One-Second Delay
.example {
transition: background-color 0.3s ease;
transition-delay: 1s;
}
Using Milliseconds
.example {
transition: opacity 300ms ease;
transition-delay: 200ms;
}
When Positive Delays Are Useful
Positive delays can help coordinate decorative effects, postpone secondary visual changes, or prevent an effect from appearing immediately during brief pointer movement.
Important Consideration
Long delays can make an interface feel unresponsive. Avoid delaying essential feedback, especially keyboard focus indicators and control state changes.
Zero Transition Delay
The value 0s starts an eligible transition without an intentional waiting period.
Basic Example
.example {
transition-delay: 0s;
}
Complete Transition
.example {
transition: opacity 0.4s ease 0s;
}
Omitting the Delay
.example {
transition: opacity 0.4s ease;
}
The omitted delay defaults to 0s, making these two declarations equivalent.
Explicitly Removing a Delay
.example {
transition-delay: 0s;
}
Use this declaration to override an existing positive or negative delay.
Zero Delay vs. Zero Duration
A zero delay does not eliminate the transition duration. A zero duration removes the gradual progression of the transition.
When to Use Zero Delay
Zero delay is appropriate for immediate visual feedback, including most hover and keyboard focus transitions.
Negative Transition Delays
A negative transition-delay causes a transition to begin as though it has already been running for part of its duration.
Basic Example
.example {
transition: opacity 1s linear;
transition-delay: -0.3s;
}
When the transition starts, it begins at the progress point corresponding to 0.3 seconds into its one-second duration.
Negative Delay in the Shorthand
.example {
transition: transform 1s ease -0.25s;
}
Delay Equal to Duration
.example {
transition: opacity 0.5s linear -0.5s;
}
Because the negative delay equals the duration, the transition has no remaining interpolation time and reaches its end state immediately.
Delay Greater Than Duration
.example {
transition: opacity 0.5s linear -1s;
}
The transition is effectively already complete when triggered.
Negative Delay With a Timing Function
.example {
transition: transform 1s ease-in-out -0.3s;
}
The initial displayed progress follows the timing function at the elapsed point. It is not necessarily 30% of the distance between the property values.
When Negative Delays Are Useful
Negative delays can be useful when an effect should begin partway through its progression instead of starting from the original value.
Important Consideration
A negative delay does not change the declared transition duration. It reduces the remaining time before the transition reaches its end state.
Multiple Transition Delays
The transition-delay property accepts a comma-separated list of time values. Each value corresponds to a transition property.
Two Properties
.example {
transition-property: opacity, transform;
transition-duration: 0.3s, 0.5s;
transition-delay: 0s, 0.2s;
}
Opacity begins immediately, while the transform waits 0.2 seconds.
Three Properties
.example {
transition-property: opacity, transform, background-color;
transition-duration: 0.3s, 0.4s, 0.5s;
transition-delay: 0s, 0.2s, 0.4s;
}
Using a Single Delay
.example {
transition-property: opacity, transform;
transition-duration: 0.3s, 0.5s;
transition-delay: 0.2s;
}
The single delay value applies to both transition properties.
Repeating Delay Values
.example {
transition-property: opacity, transform, background-color;
transition-duration: 0.3s;
transition-delay: 0s, 0.2s;
}
When fewer delay values are provided than transition properties, the list repeats as needed. The third property uses 0s.
Extra Delay Values
.example {
transition-property: opacity, transform;
transition-duration: 0.3s;
transition-delay: 0s, 0.2s, 0.4s;
}
The extra delay value does not correspond to a transition property and is not used for an additional transition.
Recommended Practice
Keep the order of transition properties, durations, timing functions, and delays consistent to make multiple transitions easier to maintain.
Duration vs. Delay
The transition-duration and transition-delay properties control different parts of a transition timeline.
| Property | Purpose |
|---|---|
transition-duration |
Specifies how long the transition takes. |
transition-delay |
Specifies when the transition begins relative to the triggering change. |
Duration Without Delay
.example {
transition-duration: 0.5s;
transition-delay: 0s;
}
The transition starts without waiting and lasts 0.5 seconds.
Duration With Positive Delay
.example {
transition-duration: 0.5s;
transition-delay: 0.3s;
}
The transition waits 0.3 seconds and then runs for 0.5 seconds.
Duration With Negative Delay
.example {
transition-duration: 0.5s;
transition-delay: -0.2s;
}
The transition starts as though 0.2 seconds have already elapsed, leaving approximately 0.3 seconds of progression.
Timeline Comparison
| Duration | Delay | Behavior |
|---|---|---|
0.5s |
0s |
Starts immediately and finishes after 0.5 seconds. |
0.5s |
0.3s |
Starts after 0.3 seconds and finishes after 0.8 seconds. |
0.5s |
-0.2s |
Starts partway through and finishes after approximately 0.3 seconds. |
These examples assume the triggering property value remains unchanged long enough for the transition to complete.
Using the transition Shorthand
The transition-delay property is included in the transition shorthand.
Longhand Syntax
.example {
transition-property: opacity;
transition-duration: 0.5s;
transition-timing-function: ease;
transition-delay: 0.2s;
}
Equivalent Shorthand
.example {
transition: opacity 0.5s ease 0.2s;
}
Time Value Order
When two time values appear in a transition shorthand definition, the first represents the duration and the second represents the delay.
.example {
transition: opacity 0.5s 0.2s ease;
}
Negative Delay
.example {
transition: opacity 1s ease -0.3s;
}
Multiple Transitions
.example {
transition: opacity 0.3s ease 0s, transform 0.5s ease-out 0.2s;
}
Shorthand Reset Behavior
.example {
transition-delay: 0.5s;
transition: opacity 0.3s ease;
}
The shorthand resets the delay to 0s because no delay is included.
Correct Declaration Order
.example {
transition: opacity 0.3s ease;
transition-delay: 0.5s;
}
The later longhand declaration overrides the delay established by the shorthand.
Recommended Practice
Use the shorthand when all transition components can be expressed clearly in one declaration. Use longhand properties when individual values need separate control.
Delays and Transition Direction
Transition delays can affect both the change into a state and the change back to the original state.
Delay in Both Directions
.button {
background-color: #2563eb;
transition: background-color 0.3s ease 0.4s;
}
.button:hover {
background-color: #1e40af;
}
Both entering and leaving the hover state use the delay declared on the base element.
Delay Only When Entering Hover
.button {
background-color: #2563eb;
transition: background-color 0.3s ease 0s;
}
.button:hover {
background-color: #1e40af;
transition-delay: 0.4s;
}
The hover transition uses the delay from the hover state. Returning to the base state uses the base delay of zero.
Delay Only When Leaving Hover
.button {
background-color: #2563eb;
transition: background-color 0.3s ease 0.4s;
}
.button:hover {
background-color: #1e40af;
transition-delay: 0s;
}
The hover transition starts without a delay. The return transition uses the 0.4-second delay from the base state.
Interrupted Transitions
If the pointer leaves before a delayed hover transition begins, the pending transition may be canceled. If a transition is already running, a new value change can reverse or replace it.
Important Consideration
When using different delays for entering and leaving a state, test rapid pointer movement and keyboard interaction to ensure the effect remains predictable.
Related CSS Properties
The transition-delay property works with the other transition longhand properties.
transition
.example {
transition: opacity 0.4s ease 0.2s;
}
Combines the transition components into a single declaration.
transition-property
.example {
transition-property: opacity;
}
Identifies which property should transition.
transition-duration
.example {
transition-duration: 0.4s;
}
Controls how long the transition lasts.
transition-timing-function
.example {
transition-timing-function: ease-in-out;
}
Controls the rate of progress during the transition.
transition-behavior
.example {
transition-behavior: allow-discrete;
}
Controls whether eligible discrete properties can participate in transitions.
Complete Example
.example {
transition-property: opacity, transform;
transition-duration: 0.3s, 0.5s;
transition-timing-function: ease, ease-out;
transition-delay: 0s, 0.2s;
transition-behavior: normal;
}
Inheritance
The transition-delay property is not inherited. Child elements do not automatically use the delay values declared on their parents.
Parent Element
.parent {
transition-delay: 0.5s;
}
Child Element
.child {
transition-delay: 0s;
}
Explicit Inheritance
.child {
transition-delay: inherit;
}
Restore the Initial Value
.child {
transition-delay: initial;
}
This restores the initial delay of 0s.
Using unset
.child {
transition-delay: unset;
}
Because the property is not inherited, unset restores its initial value.
Important Consideration
Declare transition delays on the elements whose transitions you want to control.
Practical Examples
Delayed Button Color
.button {
background-color: #2563eb;
transition: background-color 0.3s ease 0.2s;
}
.button:hover {
background-color: #1e40af;
}
Delayed Card Movement
.card {
transition: transform 0.4s ease-out 0.2s;
}
.card:hover {
transform: translateY(-5px);
}
Delayed Image Opacity
.image {
opacity: 0.7;
transition: opacity 0.3s ease 0.15s;
}
.image:hover {
opacity: 1;
}
Staggered Navigation Items
.nav-item {
opacity: 0;
transform: translateY(10px);
transition: opacity 0.3s ease, transform 0.3s ease;
}
.nav.is-open .nav-item {
opacity: 1;
transform: translateY(0);
}
.nav-item:nth-child(1) {
transition-delay: 0s;
}
.nav-item:nth-child(2) {
transition-delay: 0.1s;
}
.nav-item:nth-child(3) {
transition-delay: 0.2s;
}
Each navigation item begins its transition slightly later than the previous item. These delays also apply when the navigation closes unless overridden.
Delayed Tooltip
.tooltip {
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease 0s, visibility 0s linear 0.2s;
}
.tooltip-trigger:hover .tooltip,
.tooltip-trigger:focus-within .tooltip {
opacity: 1;
visibility: visible;
transition-delay: 0.4s, 0.4s;
}
The tooltip waits before appearing. The visibility delay coordinates with the opacity transition. A complete tooltip also needs appropriate accessibility semantics and interaction handling.
Delayed Border Color
.input {
border: 2px solid #9ca3af;
transition: border-color 0.2s ease 0.1s;
}
.input:focus-visible {
border-color: #2563eb;
}
Different Delays for Multiple Properties
.card {
transition: transform 0.3s ease 0s, box-shadow 0.3s ease 0.15s;
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
Reduced Motion Alternative
@media (prefers-reduced-motion: reduce) {
.animated-element {
transition: none;
}
}
transition-delay Example
This example compares three transition delays. Hover over or keyboard-focus each button to see when its background color changes.
HTML Example
<div class="delay-demo">
<button class="delay-button delay-none" type="button">No Delay</button>
<button class="delay-button delay-short" type="button">0.5s Delay</button>
<button class="delay-button delay-long" type="button">1s Delay</button>
</div>
CSS Example
.delay-demo {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 15px;
padding: 20px;
}
.delay-button {
min-width: 120px;
padding: 12px 18px;
border: 0;
border-radius: 4px;
background-color: #2563eb;
color: #fff;
font: inherit;
cursor: pointer;
transition-property: background-color;
transition-duration: 0.4s;
transition-timing-function: ease;
}
.delay-button:hover,
.delay-button:focus-visible {
background-color: #1e40af;
}
.delay-button:focus-visible {
outline: 3px solid #f59e0b;
outline-offset: 3px;
}
.delay-none {
transition-delay: 0s;
}
.delay-short {
transition-delay: 0.5s;
}
.delay-long {
transition-delay: 1s;
}
@media (prefers-reduced-motion: reduce) {
.delay-button {
transition: none;
}
}
Understanding the Results
All three buttons use the same transition duration and timing function. Only their delays differ.
No Delay
The background color begins changing immediately when the button is hovered or focused.
0.5s Delay
The browser waits half a second before beginning the color transition.
1s Delay
The browser waits one second before beginning the color transition.
Experiment With a Negative Delay
.delay-short {
transition-delay: -0.2s;
}
The transition starts as though 0.2 seconds of its 0.4-second duration have already elapsed.
Experiment With a Longer Duration
.delay-long {
transition-duration: 1s;
transition-delay: 0.5s;
}
The transition waits 0.5 seconds and then takes one second to finish.
Experiment With a Different Timing Function
.delay-none {
transition-timing-function: linear;
}
The color progresses at a constant rate without changing when the transition begins.
Accessibility Considerations
Transition delays can affect how quickly users receive visual feedback. Keep important interactions responsive and predictable.
Avoid Delaying Essential Feedback
Keyboard focus indicators, validation states, and important control feedback should appear promptly.
Respect Reduced Motion Preferences
@media (prefers-reduced-motion: reduce) {
.interactive-element {
transition: none;
}
}
Maintain Visible Focus Indicators
Do not delay the appearance of a keyboard focus indicator when users need it to identify the active element.
Avoid Excessive Waiting
Long delays can make controls appear unresponsive or cause users to miss important state changes.
Support Multiple Input Methods
Do not rely exclusively on hover-triggered transitions. Support keyboard and touch interaction where applicable.
Keep Content Available
Delays should not prevent users from accessing essential information or completing tasks.
Provide Immediate Alternatives
When reduced motion is requested, remove unnecessary animation and delay while preserving clear state changes.
Common Mistakes
Confusing Delay With Duration
The delay determines when a transition begins. The duration determines how long it takes.
Omitting Time Units
.example {
transition-delay: 300;
}
Use a valid time value such as 300ms.
Using Percentages
.example {
transition-delay: 50%;
}
Percentages are not valid transition delay values.
Assuming Negative Delays Are Invalid
Negative delays are valid and start transitions partway through their progress.
Expecting a Delay Without a Transition
.example {
transition-delay: 0.5s;
}
A delay alone does not create a visible transition. The element also needs an eligible property change and appropriate transition settings.
Forgetting Commas
.example {
transition-delay: 0.2s 0.4s;
}
Separate multiple delay values with commas.
Using Excessively Long Delays
Long delays can interfere with feedback and make an interface feel unresponsive.
Overwriting a Delay With the Shorthand
.example {
transition-delay: 0.5s;
transition: opacity 0.3s ease;
}
The shorthand resets the delay to 0s.
Ignoring Reverse Transitions
A delay declared on the base element may apply both when entering and leaving a state.
Expecting Pending Transitions to Always Finish
Transitions can be canceled or replaced when property values change again.
Ignoring Reduced Motion Preferences
Provide a reduced-motion alternative for nonessential transitions.
Important Considerations
Keep the following points in mind when using transition-delay:
- The property controls when a CSS transition begins.
- The initial value is
0s. - The property is not inherited.
- Values must use valid CSS time units such as
sorms. - Positive values postpone the transition.
- Zero starts the transition without an intentional delay.
- Negative values start the transition partway through its progress.
- A negative delay can equal or exceed the transition duration.
- Negative delays do not change the declared duration.
- The property accepts comma-separated lists of delays.
- Each delay corresponds to a transition property.
- Shorter delay lists repeat values as needed.
- Extra delay values are not used when there are fewer transition properties.
- The property is a longhand component of
transition. - The first time value in the shorthand represents duration.
- The second time value in the shorthand represents delay.
- A shorthand declaration resets omitted delay values.
- A delay alone does not create a transition.
- An eligible property value change is required.
- Pending transitions may be canceled by later changes.
- Delays can affect both forward and reverse transitions.
- Different states can specify different delay values.
- Long delays can make interactions feel unresponsive.
- Essential feedback should not be unnecessarily delayed.
- Respect reduced motion preferences.
- Test transition timing across supported browsers.
Browser Support
The CSS transition-delay property is widely supported across modern browsers and is part of the established CSS Transitions feature set. Positive, zero, and negative time values are supported in modern browsers.
For current compatibility information, visit Can I Use? and search for transition-delay.
Basic Declaration
.example {
transition-delay: 0.3s;
}
Negative Delay
.example {
transition-delay: -0.2s;
}
Multiple Delays
.example {
transition-delay: 0s, 0.2s, 0.4s;
}
Feature Detection
@supports (transition-delay: 0.3s) {
.example {
transition-delay: 0.3s;
}
}
Testing Recommendations
Test positive and negative delays, multiple transition lists, interrupted transitions, and different hover or focus states. The timing of visual effects can vary slightly depending on browser rendering and system performance.
Specifications
The transition-delay property is defined in the CSS Transitions Level 1 specification.
CSS Transitions Level 1 - The transition-delay Property
The specification defines transition delay values, how delays affect transition timing, and how multiple transition definitions are matched.
For additional documentation and examples, consult MDN Web Docs.
