CSS attr() Function

❮ Previous Functions Next ❯

Example

a:after {
  content: "("attr(href)")"
}

Meaning

The attr() css function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet.

Version: CSS2




Standard Syntax

attr(attributeName)



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Function Arguments

The following table describes the arguments of this function.

Argument Description
attributeName Defines the name of an attribute on the HTML element referenced in the CSS.
❮ Previous Functions Next ❯