<attr>
Retrieves the value of an attribute from an element to use directly in CSS. It is most frequently used with the content property in pseudo-elements.
Syntax
/* Usage Example */
a[data-tooltip]::before {
/* Displays the text from the data-tooltip attribute */
content: attr(data-tooltip);
position: absolute;
}
<attr> Browser support
Widely available
Since
2015 96% global usage
This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.
2+
1+
3.1+
12+