Class selector

noun

say it: “KLAS suh-LEK-ter” /klæs səˈlɛktər/

A CSS selector starting with a dot that picks elements with that class, such as .price.

What is a class selector?

A class selector starts with a dot and picks every element with that class. It is the most common way to style things.

.btn-primary { background: royalblue; color: white; }
/* <button class="btn-primary">Buy now</button> */

In a sentence

  • “The class selector .sale makes every sale price red.”

Level: Novice · More CSS terms at this level

Updated