Transition Delay

Tailwind CSS version

v1.3.0+

Utilities for controlling the delay of CSS transitions.

Class reference

Class
Properties
.delay-75transition-delay: 75ms;
.delay-100transition-delay: 100ms;
.delay-150transition-delay: 150ms;
.delay-200transition-delay: 200ms;
.delay-300transition-delay: 300ms;
.delay-500transition-delay: 500ms;
.delay-700transition-delay: 700ms;
.delay-1000transition-delay: 1000ms;

Usage

Use the delay-{amount} utilities to control an element’s transition-delay.

Transition Delay - 图1

  1. <button class="transition delay-150 duration-300 ease-in-out ...">Hover me</button>
  2. <button class="transition delay-300 duration-300 ease-in-out ...">Hover me</button>
  3. <button class="transition delay-700 duration-300 ease-in-out ...">Hover me</button>

Responsive

To control an element’s transition-delay at a specific breakpoint, add a {screen}: prefix to any existing transition-delay utility. For example, use md:delay-500 to apply the delay-500 utility at only medium screen sizes and above.

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Customizing

Delay values

By default Tailwind provides eight general purpose transition-delay utilities. You change, add, or remove these by customizing the transitionDelay section of your Tailwind theme config.

  1. // tailwind.config.js
  2. module.exports = {
  3. theme: {
  4. extend: {
  5. transitionDelay: {
  6. + '0': '0ms',
  7. + '2000': '2000ms',
  8. }
  9. }
  10. }
  11. }

Learn more about customizing the default theme in the theme customization documentation.

Responsive and pseudo-class variants

By default, only responsive variants are generated for transition-delay utilities.

You can control which variants are generated for the transition-delay utilities by modifying the transitionDelay property in the variants section of your tailwind.config.js file.

For example, this config will also generate hover and focus variants:

  1. // tailwind.config.js
  2. module.exports = {
  3. variants: {
  4. // ...
  5. - transitionDelay: ['responsive'],
  6. + transitionDelay: ['responsive', 'hover', 'focus'],
  7. }
  8. }

Disabling

If you don’t plan to use the transition-delay utilities in your project, you can disable them entirely by setting the transitionDelay property to false in the corePlugins section of your config file:

  1. // tailwind.config.js
  2. module.exports = {
  3. corePlugins: {
  4. // ...
  5. + transitionDelay: false,
  6. }
  7. }

← Transition Timing Function   Animation →