CSS Portal

CSS transition-duration Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The transition-duration property determines how long a CSS transition takes to go from the start state to the end state when an animatable property changes. It does not itself choose which properties animate — it only controls the time dimension of the animation once a change is triggered. Because it governs timing only, the perceived smoothness and purpose of a transition are shaped heavily by the value you give to this property: very short values make changes feel instantaneous, while longer values emphasize motion and can draw attention to the change.

In practice, transition-duration is used together with other transition-related properties to build a complete transition behavior. For example, you commonly set it as part of the transition shorthand, and you pair it with transition-timing-function (which controls the easing curve) and transition-delay (which defers when the transition starts). Which CSS properties actually animate is determined by transition-property; if a property is not animatable, adjusting transition-duration will have no effect on that change.

When choosing durations, consider both user experience and performance. Short durations are appropriate for micro-interactions (button feedback, hover highlights) to keep interfaces snappy; longer durations can be useful to reveal or guide attention during larger layout changes but may slow perceived responsiveness. Also be mindful of rendering cost: animating certain properties can force layout or paint work and lead to jank if the duration encourages continuous updates on low-powered devices. Finally, respect user preferences such as reduced-motion settings — when motion should be minimized, it’s common to effectively disable or shorten transitions so they do not interfere with accessibility needs.

Definition

Initial value
0s
Applies to
All elements, :before and :after pseudo elements
Inherited
No
Computed value
Same as specified value
Animatable
No
JavaScript syntax
object.style.transitionDuration

Interactive Demo

Hover over me
to see transition.

Syntax

transition-duration: <time> [, <time>]* 

Values

  • <time>The amount of time the transition from the old value of a property to the new value should take. A time of 0s indicates that no transition will happen, that is the switch between the two states will be instantaneous. A negative value for the time renders the declaration invalid.

Example

<div class="wrapper">
<h1>transition-duration example</h1>
<div class="controls">
<div class="box short">Short (0.3s)</div>
<div class="box long">Long (1.5s)</div>
</div>
<p>Hover each box to see different transition durations.</p>
</div>
/* Layout */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: #f3f4f6;
  color: #111827;
}

.wrapper {
  text-align: center;
}

/* Boxes */
.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0 0;
}

.box {
  width: 160px;
  height: 100px;
  border-radius: 8px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition-property: transform, background-color;
  /* transition-duration demonstrates the timing for the specified properties */
}

.box.short {
  transition-duration: 0.3s, 0.3s;
}

.box.long {
  transition-duration: 1.5s, 1.5s;
}

.box:hover {
  transform: translateY(-12px) scale(1.04);
  background: linear-gradient(135deg, #34d399, #10b981);
}

Browser Support

The following information will show you the current browser support for the CSS transition-duration property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!