attr

The attr() function is used to add an attribute value of an HTML element to a style property. For example, you can get the value of a class attribute and then use it as the value of the background property to change the color.

Syntax



attr( attr-name type-or-unit? [ , attr-fallback ]? )