Easy Tutorial
❮ Css3 Pr Word Break Pr Margin Top ❯

CSS attr() Function

CSS Functions

Example

The following example inserts content after each link:

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

Definition and Usage

The attr() function returns the value of an attribute of the selected element.

Supported Versions: CSS2


Browser Support

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

Function
attr() 2.0 8.0 1.0 3.1 9.0

Note: IE8 requires a !DOCTYPE to be declared to support the attr() function.


CSS Syntax

attr(attribute-name)
Value Description
attribute-name Required. The name of the HTML element's attribute.

CSS Functions

❮ Css3 Pr Word Break Pr Margin Top ❯