This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.
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.
<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>
data:hover::after {
content: " (ID " attr(value) ")";
font-size: 0.7em;
}
This element's attributes include the global attributes.
valueThis 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>
| Content categories | Flow content, phrasing content, palpable content. |
|---|---|
| Permitted content | Phrasing content. |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents | Any element that accepts phrasing content. |
| Implicit ARIA role | generic |
| Permitted ARIA roles | Any |
| DOM interface | HTMLDataElement |
| Specification |
|---|
| HTML> # the-data-element> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
data |
62 | 14 | 22 | 49 | 10 | 62 | 22 | 46 | 10 | 8.0 | 62 | 10 |
value |
62 | 14 | 22 | 49 | 10 | 62 | 22 | 46 | 10 | 8.0 | 62 | 10 |
<time> element.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/data