HTML <data> Data Tag
Tags: learnhtml, htmld
Published: 2021-02-19 08:36:31

---
title: HTML <data> Data Tag
published: true
date: 2021-02-17 12:11:12 UTC
tags: LearnHTML,HTMLD
canonical_url: https://sharepointanchor.com/learn-html/html-data-tag/
---

The [HTML](https://sharepointanchor.com/learn-html/ "HTML")  **Data tag** is used to **set the current content with the machine-readable format** by translating it. This tag provides both **machine-readable value** for data processors, and **human-readable value** for rendering in the browser. The data tag is the **new sectioning element in [HTML](https://sharepointanchor.com/learn-html/ "HTML") 5**.

This tag can be useful in cases where your data needs to be in a certain format because it may be processed by a script, but this might not be the format that you’d like your users to see.

![💡](https://s.w.org/images/core/emoji/13.0.1/72x72/1f4a1.png) **Tips** : If the content is **date or time related content** , then you can use the **<time>** element instead of the **<data>** element.

<svg aria-hidden="true" focusable="false" data-icon="clock" width="20" height="20" fill="none" stroke="currentColor" style="display:inline-block;vertical-align:-0.1em" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>Estimated reading time: 4 minutes

## Syntax:

This tag contains both the **opening data tag** and **closing data tag**. The content is written between these two tags.

```

<data value=" "> Write your text here </data>

```

### HTML data Tag:


| HTML <data> tag | Used to add a machine-readable translation of a given content |
| Content categories | Flow content, phrasing content, palpable content. |
| Permitted content | Phrasing content. |
| Tag omission | None, both opening and closing tags are mandatory. |
| Permitted parents | Any [HTML](https://sharepointanchor.com/learn-html/ "HTML") element that accepts phrasing content. |
| Implicit ARIA role | No corresponding role |
| Permitted ARIA roles | Any |
| DOM interface | [HTML](https://sharepointanchor.com/learn-html/ "HTML") DataElement |

## Sample of HTML data Tag:

```

<!DOCTYPE html>
<html>
   <head>
      <title>
         Title of the Document
      </title>
   </head>
   <body>
      <h2>Example for HTML Data Tag</h2>
      <p>Subjects Name:</p>
      <ul>
         <li>
            <data value="1000">Maths</data>
         </li>
         <li>
            <data value="1003">Science</data>
         </li>
         <li>
            <data value="1009">English</data>
         </li>
         <li>
            <data value="1030">Physics</data>
         </li>
         <li>
            <data value="1045">Chemistry</data>
         </li>
      </ul>
   </body>
</html>

```

## Result:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/result1-1.png)<figcaption>Result</figcaption>

### Download Sample File:

[Data-Tag](https://sharepointanchor.com/wp-content/uploads/2021/02/Data-Tag.html)[Download](https://sharepointanchor.com/wp-content/uploads/2021/02/Data-Tag.html)

## Attributes:

The  **data**  tag supports the  **global attributes**  and the  **event attributes**.



| Attribute | Value | Description |
| --- | --- | --- |
| value | machine-readable format | This attribute will **set the machine-readable version of the contents** which is placed inside the <data> tag |

## Styling Methods for data Tag:

You can use the following properties to style an [HTML](https://sharepointanchor.com/learn-html/ "HTML") data tag.

### Properties to style the visual weight/emphasis/size of the text in data tag:

- **[CSS](https://sharepointanchor.com/learn-css/ "CSS") font-style** – This CSS property helps to set the font style of the text such as normal, italic, oblique, initial, inherit.
- **CSS font-family** – This CSS property specifies a prioritized list of one or more font family names or generic family names for the selected element.
- **CSS font-size** – This CSS property will help to set the size of the font.
- **CSS font-weight** – This CSS property used to define whether the font should be bold or thick.
- **CSS text-transform** – This CSS property will control the text case and capitalization.
- **CSS test-decoration** – This CSS property specifies the decoration added to text such as **text-decoration-line** , **text-decoration-color** , **text-decoration- style**.

### Styles to coloring the text in <data> Tag:

- **CSS color** – This CSS property will specify the color of the text content and decorations.
- **CSS background-color** – This CSS property helps to set the background color of an element. 

### Text layout styles for data Tag:

- **CSS text-indent** – This CSS property is used to specify the indentation of the first line in a text block.
- **CSS text-overflow ** – This CSS property helps to describe how overflowed content that is not displayed should be signaled to the user.
- **CSS white-space** – This CSS property describes how white-space inside an element is handled.
- **CSS word-break**  – This CSS property decides where the lines should be broken.

### Other Properties for data Tag:

- **CSS text-shadow**  – This CSS property helps to add the shadow to text.
- **CSS text-align-last**  – This CSS property will set the alignment of the last line of the text.
- **CSS line-height** – This CSS property defines the height of a line.
- **CSS letter-spacing** – This CSS property helps to decide the spaces between letters/characters in a text.
- **CSS word-spacing** – This CSS property specifies the spacing between every word.

## Browser Support:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/browser-2.png)<figcaption>Browser Support</figcaption>

### Related Articles:

- **[HTML](https://sharepointanchor.com/learn-html/html-aside-tag/) [ Aside Tag](https://sharepointanchor.com/learn-html/html-aside-tag/)**
- **[Basic HTML Definitions and Usages in the Real World](https://sharepointanchor.com/learn-html/basic-html-definitions-and-usages-in-real-world/)**
- **[HTML Center Tag](https://sharepointanchor.com/learn-html/html-center-tag/)**
- **[HTML Big Tag](https://sharepointanchor.com/learn-html/html-big-tag/)**

The post [HTML <code><data></code> Data Tag](https://sharepointanchor.com/learn-html/html-data-tag/) appeared first on [Share Point Anchor](https://sharepointanchor.com).