Attribute selector

noun

say it: “AT-rih-byoot sih-LEK-ter” /ˈætrɪbjuːt sɪˈlɛktər/

A selector in square brackets that matches elements by an attribute or its value, such as [type="checkbox"], or a[href$=".pdf"] for links that end in .pdf.

What is an attribute selector?

An attribute selector picks elements by an attribute or its value, written in square brackets.

input[type="email"] { border-color: steelblue; }
a[target="_blank"] { padding-right: 16px; }

In a sentence

  • “An attribute selector, a[href$=".pdf"], put a small PDF label on every download link without a single new class.”

Level: Apprentice · More CSS terms at this level

Updated