CSS selectors

A selector chooses which HTML elements a CSS rule will style.

What you will learn

Minimal example

.notice { color: darkblue; } main p { line-height: 1.8; }

The first rule selects elements with class="notice". The second selects paragraphs inside main.

Common mistakes