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; }
PartWhat it does
pThe selector matches paragraphs.
colorThe property sets the text color.
tealThe 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;
}

Related lessons

Official references