<data> Tag in HTML
The <data> tag in HTML is used to associate a specific machine-readable value with human-readable content. This can be useful for displaying data in a way that is both accessible to users and easy for programs or scripts to process. The value attribute of the <data> tag stores the machine-readable data, while the content between the tags provides a readable format for users.
Key Points on <data> Tag:
- The <data> tag allows you to embed machine-readable data within human-readable content.
- It is commonly used for structured data, such as prices, dates, measurements, etc., where both formats are beneficial.
- The value attribute of the <data> tag is required and represents the machine-readable value.
- Using the <data> tag improves accessibility for automated systems and can enhance SEO.
Syntax of <data> Tag:
Syntax Example
<data value="machine-readable-value">Human-readable content</data>
Example of <data> Tag in HTML:
This example shows how to use the <data> tag to embed a machine-readable price value within a human-readable format.
Code Example
<p>Product Price: <data value="19.99">$19.99</data></p>
Output
The <data> tag is useful when you want to display information that can be processed by machines, such as prices, dates, or quantities, while maintaining readability for users. It also improves SEO by helping search engines understand the content more effectively.