Home › CSS Tutorial › CSS selectors
CSS selectors
Selectors choose which elements a rule styles.
A rule is selector { property: value; }. You can select by tag (p), class (.card) or id (#top).
Commands in this lesson
p
Definition: Defines a paragraph of text.
Syntax:
<p>Text</p>
Example:
<p>Hello, web!</p>Example code
<style>
p { color: teal; }
.big { font-size: 28px; }
#top { background: gold; }
</style>
<p>Teal paragraph</p>
<p class="big">Big paragraph</p>
<p id="top">Gold paragraph</p>