asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > DATA Element

<data> Element


Adds a machine-readable version for a given piece of content.HTML 5

HTML Syntax

NOTE: Both start and end tags are required.

Remarks

The <data> element is used to annotate a representation of a related element’s content in machine-readable format.

The value attribute must be present, and must contain the machine-readable translation.

The element serves to provide both a machine-readable value for the purposes of data processors, and a human-readable value for the purposes of rendering in a web browser.

When the value is date- or time-related, the more specific <time> element can be used instead.

Attributes

The <data> element supports the following attributes, in addition to global attributes common to all HTML elements.

AttributeValueDescription
valuemachine-readable formatSpecifies the machine-readable translation of the content of the element

Example

Here, a simple table has its numeric values encoded using the <data> element, so that a script can provide a sorting mechanism on each column despite the numbers being presented in textual form.

<script src="sort.js"></script>
<table id="sortable">
<thead>
   <tr><th>Game
      <th>Corporations
      <th>Map Size
<tbody>
<tr><td>1830
   <td><data value="8">Eight</data>
   <td><data value="93">19+74 hexes</data>
<tr>
   <td>1856
   <td><data value="11">Eleven</data>
   <td> <data value="99">12+87 hexes</data>
<tr>
   <td>1870
   <td><data value="10">Ten</data>
   <td><data value="149">4+145 hexes</data>
</table>

External References

See Also

TIME



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note