HTML <data> tag
The <data> tag defines a connection between the given section or name with the machine-readable translation. It is always associated with the value attribute.
Type: Inline Element
Syntax of <data> tag
<data value="machine-readable-value"> Readable content </data>
The <data> tag is used for semantic meaning, not for styling.
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <data> | Yes | No | Yes | Yes | Yes |
Full code example
<!DOCTYPE html> <html> <head> </head> <body> <p> Item price: <data value="999"> ₹999 </data> </p> <p> Item code: <data value="RS1256"> Red Shirt </data> </p> </body> </html>
Output on the browser
Item price: ₹999
Item code: Red Shirt
The value of the <data> tag will not display in the browser since it is what machine reads.
| Attribute | Value | Define |
|---|---|---|
| value | machine-readable format | Machine-readable translation of the corresponding section. |
More reference
The <data> tag is introduced in HTML 5 and most browsers support it. If the section is time-related or data-related content, we have to use <time> tag.
