<time> 3x4t8
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. 532a6m
Several properties in CSS accept time values, like transition-delay
, among others.
Notes and Trivia 2e6z72
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 584j31
- s
- Seconds.
- ms
- Milliseconds. There are 1000 milliseconds in a second.
Notes z5jo
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 3e5p5z
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 k5t66
Time units are ed in Chrome 11+, Firefox 4+, IE 9+, Opera 10.5+ and Safari 3.2+.
Notes z5jo
Time units are not ed in Opera Mobile.