Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
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 — The Presentation Layer

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.

The shortcut

For every request, ask "Is this about meaning or about looks?" Meaning goes in the HTML. Looks go in the CSS. Some requests need both: a new meaning in the HTML, then a look for it in the CSS.

Sorting the café owner's wishlistStep 1 of 4
  1. "Make the prices green"

    Pure looks. CSS only: a rule for .price.

The trap: choosing an HTML element for its default look. Using h1 for a small caption because it is bold, or h4 because it is the right size, lies about the page's structure. Pick the element for its meaning and let CSS set the size.

Drills

Answer fast — trust the rule.

quick drill

What does CSS stand for?

quick drill

Which of these belongs in CSS rather than HTML?

quick drill

A designer wants the "Visit us" heading to look small. What is the right move?

quick drill

Twenty pages link to one stylesheet. You change the brand colour there. How many pages change?

Remember

  • HTML says what it is; CSS says how it looks.
  • Ask "meaning or looks?" and put the change in the right layer.
  • Never pick an HTML element for its default appearance.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainMeaning or looks?

A teammate made the café's footer text small by wrapping it in an h6 heading. Explain what is wrong with that and how you would fix it.