HTML Tags
Advertisements

HTML5 <data> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <data> element links a piece of content with a machine-readable translation.

If the content is time or date related, the more specific <time> element should be used instead.

The following table summarizes the usages context and the version history of this tag.

Placement: Inline
Content: Inline, and text
Start/End Tag: Start tag: required, End tag: required
Version: New in HTML5

Syntax

The basic syntax of the <data> tag is given with:

HTML / XHTML: <data value="machine-readable"> ... </data>

The example below shows the <data> tag in action.

<p>New Products</p>
<ul>
    <li><data value="204">Green Tea</data></li>
    <li><data value="205">Tomato Ketchup</data></li>
    <li><data value="206">Roasted Coffee Beans</data></li>
</ul>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <data> tag.

Attribute Value Description
Required — The following attribute must be specified on this tag for the markup to be valid.
value machine-readable Specifies the machine-readable translation of the content of the element.

Global Attributes

Like all other HTML tags, the <data> tag supports the global attributes in HTML5.


Event Attributes

The <data> tag also supports the event attributes in HTML5.


Browser Compatibility

The <data> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 22+
  • Google Chrome 62+
  • Edge 13+
  • Apple Safari 10+
  • Opera 49+

Further Reading

See tutorial on: HTML Lists.

Related tags: <time>.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties