CSS attr() Function

❮ Previous Functions Next ❯


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


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


Browser Support

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


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 ❯