×

css · level 1 · unit 1 · lesson 4

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

Colours have names, and a rule can set more than one thing.

CSS knows over a hundred colour names, from red and blue to tomato, skyblue and hotpink. Names never have spaces: it is lightgreen, not light green.

color paints the words. background-color paints the , the area behind them. Dark words on a pale background are the clearest to read.

A property with its value is called a . One rule can hold as many as you like. Put each on its own line and end every one with a semicolon.

<h1>Beach day</h1>
<p>Bring a towel and a bucket.</p>
h1 {
  color: navy;
  background-color: skyblue;
}

Press show my page to see it here.

Look closely: the background fills the whole width of the heading, not only the space behind the letters.