Utilities for controlling the delay of CSS animations.
Class | Properties |
---|---|
anim-delay-75 |
animation-delay: 75ms; |
anim-delay-100 |
animation-delay: 100ms; |
anim-delay-150 |
animation-delay: 150ms; |
anim-delay-200 |
animation-delay: 200ms; |
anim-delay-300 |
animation-delay: 300ms; |
anim-delay-500 |
animation-delay: 500ms; |
anim-delay-700 |
animation-delay: 700ms; |
anim-delay-1000 |
animation-delay: 1000ms; |
Use the anim-delay-{amount}
utilities to control an element’s animation-delay
.
<button class="animate-bounce anim-delay-150 anim-duration-300 ...">
Button A
</button>
<button class="animate-bounce anim-delay-300 anim-duration-300 ...">
Button B
</button>
<button class="animate-bounce anim-delay-700 anim-duration-300 ...">
Button C
</button>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:anim-delay-0
to only apply the anim-delay-0
utility on hover.
<div class="animate-bounce anim-duration-300 anim-delay-150 hover:anim-delay-0">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:anim-delay-0
to apply the anim-delay-0
utility at only medium screen sizes and above.
<div class="animate-bounce anim-duration-300 anim-delay-150 md:anim-delay-0">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
By default, Tailwind provides animation-delay
utilities for all of the built-in browser keyword options. You can customize these values by editing theme.animationDelay
or theme.extend.animationDelay
in your tailwind.config.js
file.
// @filename tailwind.config.js
module.exports = {
theme: {
extend: {
animationDelay: {
"2s": "2s",
},
},
},
}
Learn more about customizing the default theme in the theme customization documentation.
If you need to use a one-off animation-delay
value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="anim-delay-[2s]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.