data

Links content with a machine-readable value.

Description

The <data> element links a given piece of content with a machine-readable translation. If the content is time- or date-related, use the <time> element instead.

The value attribute provides the machine-readable equivalent of the element's content. This is useful for data processors, search engines, or scripts that need to work with the data in a standardized format.

Basic Example

The price is $49.99.

<p>The price is <data value="49.99">$49.99</data>.</p>

Product Identifiers

Use <data> to associate products with their identifiers:

  • Wireless Headphones - $79.99
  • Bluetooth Speaker - $49.99
  • USB-C Cable - $12.99
<ul> <li><data value="UPC:012345678901">Wireless Headphones</data> - $79.99</li> <li><data value="UPC:012345678902">Bluetooth Speaker</data> - $49.99</li> <li><data value="UPC:012345678903">USB-C Cable</data> - $12.99</li> </ul>

Non-Date Values

While dates should use <time>, <data> can store date strings when appropriate:

The event is scheduled for June 15th, 2024.

<p> The event is scheduled for <data value="2024-06-15">June 15th, 2024</data>. </p>

Note: For dates and times, prefer using the <time> element with its datetime attribute.

Currency Values

Store normalized currency values while displaying localized formats:

USA $1,000
UK £800
EU €900
<table> <tr> <td>USA</td> <td><data value="1000">$1,000</data></td> </tr> <tr> <td>UK</td> <td><data value="800">£800</data></td> </tr> <tr> <td>EU</td> <td><data value="900">€900</data></td> </tr> </table>

Attributes

Attribute Description
value Required. The machine-readable translation of the element's content.

This element also supports global attributes.

Accessibility

The <data> element has no special accessibility behavior. Screen readers will read the visible content, not the value attribute. The value is intended for machine processing.

Related Elements

  • <time> - For dates and times (preferred for temporal data)
  • <meter> - For scalar measurements within a known range