transition-delay
Quick Summary for transition-delay
The transition-delay CSS property specifies the duration to wait before starting a property's transition effect when its value changes.
Code Usage for transition-delay
/* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms;  /* Global values */ transition-delay: inherit; transition-delay: initial; transition-delay: revert; transition-delay: unset; 
More Details for transition-delay

transition-delay

The transition-delay CSS property specifies the duration to wait before starting a property's transition effect when its value changes.

The delay may be zero, positive, or negative:

A value of 0s (or 0ms) will begin the transition effect immediately. A positive value will delay the start of the transition effect for the given length of time. A negative value will begin the transition effect immediately, and partway through the effect. In other words, the effect will be animated as if it had already been running for the given length of time.

You may specify multiple delays, which is useful when transitioning multiple properties. Each delay will be applied to the corresponding property as specified by the transition-property property, which acts as a master list. If there are fewer delays specified than in the master list, the list of delay values will be repeated until there are enough. If there are more delays, the list of delay values will be truncated to match the number of properties. In both cases, the CSS declaration remains valid.

Syntax

/* <time> values */ transition-delay: 3s; transition-delay: 2s, 4ms;  /* Global values */ transition-delay: inherit; transition-delay: initial; transition-delay: revert; transition-delay: unset; 

Values

<time>

Denotes the amount of time to wait between a property's value changing and the start of the transition effect.

Formal definition

Initial value0s
Applies toall elements, ::before and ::after pseudo-elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

<time>#

Examples

Example showing different delays

HTML
  <div class="box delay-1">0.5 seconds</div>    <div class="box delay-2">2 seconds</div>    <div class="box delay-3">4 seconds</div>    <button id="change">Change</button> 
CSS
.box {   margin: 20px;   padding: 10px;   display: inline-block;   width: 100px;   height: 100px;   background-color: red;   font-size: 18px;   transition-property: background-color font-size transform color;   transition-timing-function: ease-in-out;   transition-duration: 3s; }  .transformed-state {   transform: rotate(270deg);   background-color: blue;   color: yellow;   font-size: 12px;   transition-property: background-color font-size transform color;   transition-timing-function: ease-in-out;   transition-duration: 3s; }  .delay-1 {   transition-delay: 0.5s; }  .delay-2 {   transition-delay: 2s; }  .delay-3 {   transition-delay: 4s; } 
JavaScript
function change() {   const elements = document.querySelectorAll("div.box");   for (let element of elements) {     element.classList.toggle("transformed-state");   } }  const changeButton = document.querySelector("#change"); changeButton.addEventListener("click", change); 
Result

Specifications

Specification
CSS Transitions Level 2 # transition-delay-property

See also

Using CSS transitions TransitionEvent API

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)EspañolFrançais日本語한국어Português (do Brasil)中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
Old programmers never die; they just lose some of their functions.
Random CSS Property

<gradient>

The <gradient> CSS data type is a special type of <image> that consists of a progressive transition between two or more colors.
<gradient> css reference