> 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.

# `<time>`

APISummary
`<time>` 数据类型表达了以秒（`s`）或毫秒（`ms`）为单位的时间的值。于 `animation`、`transition` 及相关属性中使用。

## 语法

`<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        数字与单位间不允许有空格。
```

## 兼容性

**Compatibility Table**

**Query:** `css.data-type.time`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/css/data-type/time.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| time | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.5) | Yes (1.5) | Yes |

**`time`**

<code>&lt;time&gt;</code>

**Specifications:**
- [https://drafts.csswg.org/css-values/#time](https://drafts.csswg.org/css-values/#time)

