Note/Info The <data> tag is a new tag in HTMl5.
HTML5 <data> tag
This <data> tag sets machine readable values for the given contents.
If you wish to have the contents in an alternative format, then you can use this tag.
Suppose, you wish to have 2 formats for your content –
- Machine-readable format – For machine to process your content
- Human-readable format – For your readers to read.
In this case, it is best to use the <data> tag.
Syntax:
<data value=”numbers”>text..</data>
Example
<ul> <li> <data value="1">Long grain</data> </li> <li> <data value="2">Brown Long Grain Rice</data> </li> <li> <data value="3">Basmati Rice</data> </li> <li> <data value="3">Jasmine Rice</data> </li> </ul>
Default CSS Value
NONE
How Browser will display
INLINE.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | New tag in HTML5 |
Attributes used with <data> tag
Attribute | Description |
---|---|
value | This is a mandatory attribute. This defines a machine-readable format of the content |
Note/Info:
Do not use the time-related or date-related content using the <data> tag. For this purpose, you should use the <time> tag.
Global Attributes
The <data> tag supports Global attributes.
Event Attributes
The <data> tag supports Event attributes.
Supporting Browsers
Related Tags
<li>, <ul>, <ol> tags