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

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

内容类别 流内容 , 措词内容 ,可触及内容。
准许内容 措词内容 .
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts 措词内容 .
Implicit ARIA role 无对应角色
Permitted ARIA roles 任何
DOM 接口 HTMLDataElement

属性

This element's attributes include the 全局属性 .

value

This attribute specifies the machine-readable translation of the content of the element.

范例

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

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

规范

规范 状态 注释
HTML 实时标准
The definition of '<data>' in that specification.
实时标准 无变化自 HTML5
HTML5
The definition of '<data>' in that specification.
推荐 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
data Chrome 完整支持 62 Edge 完整支持 ≤18 Firefox 完整支持 22 IE 不支持 No Opera 完整支持 49 Safari 完整支持 10 WebView Android 完整支持 62 Chrome Android 完整支持 62 Firefox Android 完整支持 22 Opera Android 完整支持 46 Safari iOS 完整支持 10 Samsung Internet Android 完整支持 8.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: