CSS · Functions and values

attr()

Reads an attribute value. Content support is broad; use with a fallback when needed.

Syntax
attr(name)

Example

Try it

More in this group

blur() brightness() / contrast() circle() / ellipse() color-mix() color() function conic-gradient() counter() / counters() cubic-bezier()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course