For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/data-type/time.md.
Lynx
  • 简体中文
  • <time>

    <time> 数据类型表达了以秒(s)或毫秒(ms)为单位的时间的值。于 animationtransition 及相关属性中使用。

    语法

    <time> 数据类型由 ​​​​​​<number> 后加下方列出的单位之一组成。前方也可选择添加一个 +-。单位与数字之间无空格。

    单位

    • s 以秒为单位的时间。例:0s, 1.5s, -60s

    • ms 以毫秒为单位的时间。例:0ms, 150.25ms, -60000ms

    实例

    有效时间

    12s         正整数
    -456ms      负整数
    4.3ms       非整数
    14mS        单位大小写不敏感,虽然不推荐大写
    +0s         0以及前置 + 号和单位
    -0ms        0以及前置 - 号和单位

    无效时间

    0           尽管<length>中允许0,其在<time>中无效。
    12.0        此为<number>而非<time>。其缺乏单位。
    7 ms        数字与单位间不允许有空格。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。