HTML data-* Attribute
Example
Using the data-* attribute to embed custom data:
- Owl
- Salmon
- Tarantula
Try it »
Browser support





All major browsers support the data-* attribute.
Definition and Usage
The data-* attribute is used to store custom data private to the page or application.
The data-* attribute allows data to be embedded in all HTML elements.
Custom data can give a page a better interactive experience (without the need to use Ajax or query the server for data).
The data-* attribute consists of two parts:
- The attribute name must not contain uppercase letters, and there must be at least one character after data-.
- The attribute can be any string
Note: The custom attribute prefix "data-" is ignored by the client.
Differences between HTML 4.01 and HTML5
The data-* attribute is new in HTML5.
Syntax
<
element
data-*="
somevalue
">
HTML Global Attributes