<data>:数据元素

<data> HTML 元素将给定的内容片段与机器可读的翻译链接起来。如果内容与时间或日期相关,则必须使用 <time> 元素。

¥The <data> HTML element links a given piece of content with a machine-readable translation. If the content is time- or date-related, the <time> element must be used.

Try it

属性

¥Attributes

该元素的属性包括 全局属性

¥This element's attributes include the global attributes.

value

该属性指定元素内容的机器可读翻译。

示例

¥Examples

以下示例显示产品名称,但还将每个名称与产品编号相关联。

¥The following example displays product names but also associates each name with a product number.

html
<p>New Products</p>
<ul>
  <li><data value="398">Mini Ketchup</data></li>
  <li><data value="399">Jumbo Ketchup</data></li>
  <li><data value="400">Mega Jumbo Ketchup</data></li>
</ul>

结果

¥Result

技术总结

¥Technical summary

内容类别 流量内容措辞内容,可触及的内容。
允许的内容 措辞内容.
标签遗漏 无,开始和结束标记都是强制性的。
允许的父级 任何接受 措辞内容 的元素。
隐式 ARIA 角色 generic
允许的 ARIA 角色 任何
DOM 接口 HTMLDataElement

规范

Specification
HTML Standard
# the-data-element

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also