Transitions & Animation
Utilities for controlling the duration of CSS transitions.
Class | Styles |
---|---|
duration-<number> | transition-duration: <number>ms; |
duration-initial | transition-duration: initial; |
duration-(<custom-property>) | transition-duration: var(<custom-property>); |
duration-[<value>] | transition-duration: <value>; |
Use utilities like duration-150
and duration-700
to set the transition duration of an element in milliseconds:
Hover each button to see the expected behavior
Use the duration-[<value>]
syntax to set the transition duration based on a completely custom value:
<button class="duration-[1s,15s] ..."> <!-- ... --></button>
For CSS variables, you can also use the duration-(<custom-property>)
syntax:
<button class="duration-(--my-duration) ..."> <!-- ... --></button>
This is just a shorthand for duration-[var(<custom-property>)]
that adds the var()
function for you automatically.
Prefix a transition-duration
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<button class="duration-0 md:duration-150 ..."> <!-- ... --></button>
Learn more about using variants in the variants documentation.