Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

What is a data element in HTML?

Dian Us Suqlain

The purpose of using a data element inside an HTML document is to link a given piece of content with a machine-readabledata in a format that a computer can process translation.

The data element works as a translator, as it provides content written in both human-understandable and machine-readable language.

Where to use a 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.

Syntax

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).

"data" and "value" tag illustration

Code

The following is an example of how a <data> element is declared and used inside an unordered-listusing the <ul> tags, the list items will be marked with bullets.

<data> element in an HTML documet.

RELATED TAGS

html

CONTRIBUTOR

Dian Us Suqlain
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring