語法
<time> 資料型別由一個 <number> 後跟下面列出的其中一個單位組成。可選地,它前面可以帶一個 + 或 - 符號。與所有尺寸一樣,單位字面量和數字之間沒有空格。
注意:儘管數字 0 在任何單位下都相同,但單位不能省略。換句話說,0 是無效的,不表示 0s 或 0ms。
單位
注意:s 和 ms 之間的轉換遵循邏輯 1s = 1000ms。
示例
有效時間
12s Positive integer -456ms Negative integer 4.3ms Non-integer 14mS The unit is case-insensitive, although capital letters are not recommended. +0s Zero with a leading + and a unit -0ms Zero with a leading - and a unit
無效時間
0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit.
規範
| 規範 |
|---|
| CSS 值和單位模組第 4 級 # 時間 |
瀏覽器相容性
載入中…