Data attributes allow you to store custom data on HTML elements. This data can be read by JavaScript and CSS selectors but does not affect the element's appearance or behavior by itself.
Data attributes must start with 'data-' followed by lowercase letters and hyphens. The value should be quoted.
<div data-info="secret">Visible Text</div>
The content inside the <div> is 'Visible Text', which is what the browser shows. The data attribute is invisible by default.
The CSS attribute selector syntax is [attribute="value"]. This selects elements with the exact data-role attribute value.
Assistive technologies do not read data attributes by default. Important accessibility info should use ARIA attributes or semantic HTML.
