Your first CSS rule
W3C CSS Snapshot 2026
CSS (Cascading Style Sheets) describes how HTML looks. HTML gives a paragraph its role on the page; CSS can change its color, spacing, and position. This lesson uses the HTML document structure you already built.
On this page
Read a CSS rule
A rule tells the browser which elements to style and what to change. Try this rule on two paragraphs.
p { color: teal; }
| Part | What it does |
|---|---|
p | The selector matches paragraphs. |
color | The property sets the text color. |
teal | The value is the color to use. |
What to expect Both paragraphs turn teal. Replace teal with purple and run again.
Write more than one declaration
The braces hold the declarations. Separate the property and value with a colon, then end each declaration with a semicolon.
p {
color: teal;
line-height: 1.6;
}