---
title: Class Equals
---
## Class Equals
To select an item with a class attribute, you use the following selector:

```css
p[class="happy"] {
    color: yellow;
}
```

This selector is not commonly used, as there is a general class selector. We can rewrite the above selector like this:

```css
p.happy {
    color: yellow;
}
```

#### More Information:
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
