attr()
Retrieves the value of an attribute from an element to use directly in CSS. The classic use is with the content property in pseudo-elements; using attr() with typed values on other properties is a newer experimental extension.
Quick 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 99% global usage
This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.
Safe to use without fallbacks.
4+
2+
3.1+
12+