Skip to the workspace
Pebellslearn by building
Introduction  ›  Lesson

CSS — The Presentation Layer

CSS 12 minHTML describes what content means while CSS describes how it looks, so each change belongs in the layer that matches its purpose.

css / CSS — The Presentation Layer

Explore each scene at your own pace.

01 · The rule

The rule

CSS — The Presentation Layer

HTML describes what content means while CSS describes how it looks, so each change belongs in the layer that matches its purpose.

Separate a document's meaning from the presentation rules applied to it.

Two websites can share exactly the same HTML and look nothing alike: one dark and minimal, one bright and playful. The difference is entirely in the stylesheet. CSS, short for Cascading Style Sheets, is the language that decides how a page looks.

The rule

HTML says what it is; CSS says how it looks.

HTML carries meaning: this is a heading, this is a list, this is navigation. CSS carries presentation: colour, fonts, spacing, sizes, layout, and how all of that adapts to a phone or a wide monitor. It can even animate.

A piece of CSS is a set of rules. Each rule picks some elements and gives them styles:

.price {
  color: green;
  font-weight: bold;
}

This one rule turns every café price green and bold, however many prices the menu has.

Keeping the two apart pays off in three ways:

  • Reuse: one stylesheet can style every page of a site.
  • Change: a redesign touches the CSS and leaves the content alone.
  • Access: screen readers and search engines read the HTML's meaning, so it must stay honest whatever the design.

The word "cascading" matters too. Many rules can target the same element, and CSS has a fixed procedure for deciding which one wins. You will meet it at the end of the next section.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.