Text Content
HTML <data> element
Associates human-readable content with a machine-readable value. Use time instead for date and time values. Use the value attribute for a machine-readable identifier that may differ from the visible label. Unlike a data-* attribute, data itself gives the represented content an explicit value. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<data value="machine-value">Label</data>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | machine-readable string | Required machine-readable equivalent of the visible content. |
Return Value
HTMLDataElement
Content model: Phrasing content, with element-specific restrictions.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>HTML example</title> </head> <body> <p> <data value="BK-42">Pocket notebook</data> </p> </body></html>