Grade 9 Computer Science · The web — a page’s three languages

Three languages, three jobs

Why a page is not written in one language, and what each of the three does.

A page without a single color, and it still works

You can write a page without any color, spacing or animation, and it will still work — and a search engine will understand it exactly as it understands the styled version. So why is a page written in three languages and not one? It turns out each language answers an entirely different question.

A web page is written in three different languages working together. That sounds like a historical complication, and it is in fact a deliberate separation — the same separation of roles seen in breaking into functions and files, only that here it is enforced by the tools themselves.

Each layer answers an entirely different question about the same page.
The questionThe job
What is hereStructure and meaning
How does it lookAppearance
What happens when touchedBehaviour
<!-- structure -->
<button id="more">Show more</button>

/* appearance */
#more { padding: 8px 16px; border-radius: 6px; }

// behaviour
document.querySelector("#more").addEventListener("click", reveal)

Why it was built this way

The separation gives exactly what we saw a separation of roles always gives: one can be changed without touching the others. Redesigning a whole site changes the appearance layer and touches nothing in the structure; adding behaviour requires changing nothing in what is written on the page. And there is a second advantage here with no counterpart in ordinary code: the same structure is read also by whoever does not see the appearance at all — a search engine, a screen reader, or an old browser. The bottom layer is what remains when everything else falls away.

Example 1 — changing appearance without touching structure

  1. The site’s design changes entirely.
  2. The appearance layer is rewritten.
  3. The structure stays exactly as it was.
  4. And the behaviour keeps working too.

Example 2 — whoever reads only the structure

  1. A screen reader does not see colours.
  2. It reads the structure alone.
  3. If the structure is right, the page is usable.
  4. And if not — the appearance will not help.
A page with the first column alone still works and reads — it just looks plain.