What are Data Attributes
Created: 20.03.2023
Author: Anastasia Nogovitsyna
HTML elements have attributes. These are the values that configure elements or regulate their behavior in various ways to meet user criteria.
A data attribute is a custom attribute that allows you to store additional information within standard HTML elements. data attributes are regular HTML attributes that can be accessed in CSS. The name of a data attribute always begins with data- (e.g., data-testid).
Any attribute whose name starts with `data-` is a `data-*` attribute.
data- attributes are a standard solution for storing user-specific metadata associated with elements.
Example usage: data-sku="12345"
Last updated