# Class selector

Starts with a dot and selects elements with that class.

## 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.

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

Level: Novice · [More CSS terms at this level](https://www.ask-codey.com/glossary/subjects/css/novice)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/class-selector
