<data>
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.
HTML <data>
元素将一个指定内容和机器可读的翻译联系在一起。但是,如果内容是与时间或者日期相关的,则一定要使用 <time>
。
尝试一下
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
标签省略 | 不允许,开始标签和结束标签都不能省略。 |
Permitted parents | Any element that accepts phrasing content. |
DOM 接口 | HTMLDataElement |
属性
示例
下面的示例展示了一些产品名称,而且每个名称都和一个产品编码相关联。
html
<p>新产品</p>
<ul>
<li><data value="398">迷你番茄酱</data></li>
<li><data value="399">巨无霸番茄酱</data></li>
<li><data value="400">超级巨无霸番茄酱</data></li>
</ul>
规范
Specification |
---|
HTML # the-data-element |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
data | ||||||||||||
value |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on 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.
参见
- HTML
<time>
元素。