CSS <time> Data Type
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.
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
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
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.
Desktop





Tablets & Mobile





