Favorites

CSS transition-duration Property

transition-duration
CSS PropertyThis property is supported by all modern browsers.
Updated 22nd November 2026

The transition-duration property sets how long a transition takes, such as 0.3s.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

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 the grey area:

Box
Demo Code
HTML Code
<p class="demo-hint">Hover over the grey area:</p>
<div class="demo-track">
	<div class="demo-element">Box</div>
</div>
CSS Code
.demo-track {
	display: flex;
	justify-content: flex-end;
	width: 300px;
	padding: 10px;
	box-sizing: border-box;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
	font-size: 13px;
	color: #666;
}
.demo-track:hover .demo-element {
	margin-right: 0;
	background-color: #f72585;
	color: #1b1f3b;
}
.demo-hint {
	margin: 0 0 6px;
	font-size: 13px;
	color: #666;
}
.demo-element {
	width: 80px;
	height: 60px;
	margin-right: 190px;
	padding: 8px;
	box-sizing: border-box;
	background-color: #4361ee;
	color: #fff;
	font-size: 15px;
	font-weight: bold;
	transition-duration: 500ms;
	transition-property: margin-right;
}

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);
}
Open in editor

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
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.