CSS Reference Data Type

<time> 6d1aw

The <time> CSS data type represents a time dimension. The format of a time value is a <number> followed by a case-insensitive unit of time: seconds or milliseconds. There are no spaces allowed between the number and the unit. 63ua

Several properties in CSS accept time values, like transition-delay, among others.

Notes and Trivia 2r6h2b

CSS <length> values allow removing the unit identifier from a value when that value is zero. When a <time> value is zero, on the other hand, the unit can not be omitted, as 0 alone won’t be a valid <time> value without its unit.

Values 445h6m

s
Seconds.
ms
Milliseconds. There are 1000 milliseconds in a second.

Notes 6p2z1x

Properties may restrict the time value to some range. If the value is outside the allowed range, the declaration is invalid and must be ignored. Negative values are allowed for some properties such as the transition-delay property.

Examples 5w70f

The following example shows the use of a time value to specify the duration of a transition on an element, that applies a transition on the width of the element.

.el {
    transition-duration: 3s;
}
                

The following are all valid time values:

34.6s /* accepts non-integer values */
98MS /* unit is case-insensitive so it can be all-uppercase, although uppercase letters are not recommended for time values */
                

The following are invalid time values:

0 /* must have a unit */
56 /* must have a unit */
74 ms /* cannot have white space between number and unit */

Browser 51c73

Time units are ed in Chrome 11+, Firefox 4+, IE 9+, Opera 10.5+ and Safari 3.2+.

Notes 6p2z1x

Time units are not ed in Opera Mobile.

Written by

Last updated June 4, 2020 at 4:59 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.