The purpose of using a data
element inside an HTML document is to link a given piece of content with a
The data
element works as a translator, as it provides content written in both human-understandable and machine-readable language.
data
element?We use a data
element where there is a need to make the server or computer understand the content written on the webpage.
A data
element is placed inside tags (<>
): <data>
in an HTML document and includes both an opening (<data>
) and closing (</data>
) tag.
It is always mandatory to include the value
attribute inside the <data>
tag. Without the value
attribute, it would not be machine-readable.
The value
attribute represents an element’s contents in a machine-readable format, i.e., binary (0’s and 1’s).
The following is an example of how a <data>
element is declared and used inside an <ul>
tags, the list items will be marked with bullets
Free Resources