Favorites

CSS <time> Data Type

<time>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <time> data type is a duration, written as a number with the unit s or ms, such as 2s or 300ms. It is used by transitions and animations.

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 <time> CSS data type represents a duration: an amount of time, written as a <number> immediately followed by the unit s (seconds) or ms (milliseconds). For example, 1.5s, 250ms and 0s are all <time> values. It is used by properties that control how long something takes or how long to wait, mainly transition-duration, transition-delay, animation-duration and animation-delay, as well as the transition and animation shorthands.

One second equals 1000 milliseconds, so 0.3s and 300ms are the same value. A unit is always required, even for zero: 0 on its own is invalid where a <time> is expected, so write 0s. Durations cannot be negative, but delays can: a negative delay such as animation-delay: -1s starts the animation as if it had already been running for one second, which is a handy way to offset several copies of the same animation.

<time> values can be combined in calc() and other math functions, and they can be multiplied by numbers, which makes it easy to build staggered delays from custom properties. Do not confuse this data type with the HTML time element, which marks up dates and times in a document.

Examples:

.button {
  transition: background-color 200ms ease, transform 0.15s ease;
}

.spinner {
  animation: spin 1.2s linear infinite;
}

/* Staggered start using a custom property and calc() */
.list li {
  animation: fade-in 0.4s both;
  animation-delay: calc(var(--i) * 80ms);
}

Interactive Demo

Demo Code
HTML Code
<div class="demo-lane">
	<div class="demo-element"></div>
</div>
CSS Code
@keyframes demo-slide {
	from {
		translate: 0;
	}
	to {
		translate: 240px;
	}
}
.demo-lane {
	width: 300px;
	padding: 10px;
	box-sizing: border-box;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
}
.demo-element {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #f72585;
	animation: demo-slide 2s ease infinite alternate;
	animation-duration: 0.4s;
}

Syntax

property: <time>; 

Values

  • sRepresents a time in seconds, for example 2s or 0.25s.
  • msRepresents a time in milliseconds, for example 250ms. 1s equals 1000ms.

Example

<div class="wrap">
<h1>CSS &lt;time&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="track"><span class="ball d1"></span></div>
<div class="label">animation-duration: 500ms</div>
</div>
<div class="card">
<div class="track"><span class="ball d2"></span></div>
<div class="label">animation-duration: 1s</div>
</div>
<div class="card">
<div class="track"><span class="ball d3"></span></div>
<div class="label">animation-duration: 2.5s</div>
</div>
<div class="card">
<div class="track"><span class="ball d4"></span></div>
<div class="label">1s with animation-delay: -0.5s</div>
</div>
<div class="card">
<div class="hover-box"></div>
<div class="label">hover: transform 300ms, background-color 1s</div>
</div>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/* 
Open in editor

Browser Support

The following information will show you the current browser support for the CSS time data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type 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.