Transition Timing Function

Tailwind CSS version

v1.2.0+

Utilities for controlling the easing of CSS transitions.

Class reference

Class
Properties
.ease-lineartransition-timing-function: linear;
.ease-intransition-timing-function: cubic-bezier(0.4, 0, 1, 1);
.ease-outtransition-timing-function: cubic-bezier(0, 0, 0.2, 1);
.ease-in-outtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);

Usage

Use the ease-{timing} utilities to control an element’s easing curve.

Transition Timing Function - 图1

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

Responsive

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

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

Customizing

Timing values

By default Tailwind provides four general purpose transition-timing-function utilities. You change, add, or remove these by customizing the transitionTimingFunction section of your Tailwind theme config.

  1. // tailwind.config.js
  2. module.exports = {
  3. theme: {
  4. extend: {
  5. transitionTimingFunction: {
  6. + 'in-expo': 'cubic-bezier(0.95, 0.05, 0.795, 0.035)',
  7. + 'out-expo': 'cubic-bezier(0.19, 1, 0.22, 1)',
  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-timing-function utilities.

You can control which variants are generated for the transition-timing-function utilities by modifying the transitionTimingFunction 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. - transitionTimingFunction: ['responsive'],
  6. + transitionTimingFunction: ['responsive', 'hover', 'focus'],
  7. }
  8. }

Disabling

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

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

← Transition Duration   Transition Delay →