Data HTML

HTML <data> Tag

To provide a machine-readable version of the specified content, the HTML <data> tag is used. The data is displayed in a special format. It is useful both for getting a machine-readable value for data processors and for displaying a human-readable value on a browser.

Syntax:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<data value=”1″>content</data>
<data value=”1″>content</data>
<data value=”1″>content</data>

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<p>List of Students Names:</p>
<ul>
<li><data value="110">Happy Singh</data></li>
<li><data value="210">Joy Gupta</data></li>
<li><data value="310">Smiley Das</data></li>
</ul>
</body>
</html>
<!DOCTYPE html> <html> <body> <p>List of Students Names:</p> <ul> <li><data value="110">Happy Singh</data></li> <li><data value="210">Joy Gupta</data></li> <li><data value="310">Smiley Das</data></li> </ul> </body> </html>
<!DOCTYPE html>
<html>
<body>
<p>List of Students Names:</p>
<ul>
  <li><data value="110">Happy Singh</data></li>
  <li><data value="210">Joy Gupta</data></li>
  <li><data value="310">Smiley Das</data></li>
</ul>
</body>
</html>

Explanation:

In the above example, a list of students’ names is displayed, where each name is associated with the student’s ID.

Tag specific Attributes:

Attribute Uses
value Used to define the machine-readable version of the specified content.

Global Attributes:

The Global attributes are supported by the HTML <data> tag.

Supporting Browsers:

Chrome, IE, Firefox, and Opera.