The <data>
tag adds a machine-readable value to its content.
This information is not visible to the users.
But it is readable by JavaScript and machine-readable devices.
Four <data>
tags with invisible, but machine-readable, population numbers.
<ol>
<li><data value="8,601,186">New York</data></li>
<li><data value="4,057,841">Los Angeles</data></li>
<li><data value="2,679,044">Chicago</data></li>
<li><data value="2,359,480">Houston</data></li>
</ol>
The <data>
tag adds a machine-readable value to its content.
It associates human-readable content to a machine-readable value for data processors.
The <data>
tag is useful for appending additional data to an HTML element.
If the value is time or date related, then use a <time> element instead.
Note: Not all browsers support the <data>
element.
Consider using a data-* attribute instead.
This table lists the <data>
tag attributes.
Attribute | Value | Description |
---|---|---|
value | string value | Any machine-readable value. |
id | identifier | Defines a unique identifier for the data element. |
For addional global attributes see our global attributes list.
<data>
valueThe value attribute accepts any string value.
JSON data is perfect for JavaScript to process.
HTML data is treated as text so you can assign HTML code without encoding.
A value attribute with an HTML string.
<data value="This is HTML code.<br />">Content item<data>
Here is when <data>
support started for each browser:
Chrome
|
62.0 | Oct 2017 |
Firefox
|
22.0 | Jun 2013 |
IE/Edge
|
13.0 | Jan 2020 |
Opera
|
49.0 | Nov 2017 |
Safari
|
-- | Not supported |