References

Collection of references for web development.

HTML data (attr) attribute

Description

Specifies custom data for an element, you can use multiple data attributes.

Values

Value
string

Example

<div data-my-custom-attribute-name="your data here">Hello World</div>

Example #2

<style>
div[data-txt]::after {
	content:attr(data-txt);
}
</style>
<div data-txt="Hello World"></div>