I wonder why you use the data tag.

Asked 2 years ago, Updated 2 years ago, 100 views

I wonder why you use the data tag. Is it just the semantic role of 'this is data linked to the server'?

fast-frontend html html5 data

2022-09-22 19:23

1 Answers

Hello, I'm Yamoo.

We are answering your inquiry. :-)

The <data> element is newly added to HTML5 to accommodate the need for a wider data format than machine-readable. The value property value will be interpreted by the machine, and this property must be used.

This element is used by the Programming Group for processing information, so it does not have to be displayed on the User Screen (View) bar.

For example, if you have hyperlink structuring associated with a book title, exposing the unique ID values of each book is long-coded and not easy for humans to read. (You can't tell the title of the book just from the ID values of the book.)

In this case, you can structure it with the <data> element to enter the Book ID value for the machine to read it, and include human-readable content inside.

It can also be used to structure the product ID into data values, as shown below.

NOTE For structuring where data values are associated with date/time The <time> element is more appropriate.

<p>
  I'm not sure if I'm with her 
  <time datetime="2018-03-19T20:00-21:00"> The first day we met was late at night</time>
  It went on.
</p>

Browser compatibility (2018.03.19) - IE / Safari not supported


2022-09-22 19:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.