Chapter Two · Meaning

HTML: Structure and Meaning

HTML from the ground up: how every element is shaped, how text becomes an outline, how pages link to each other and to images, how a page names its regions, and how to see the page the browser really built.

A web page starts as meaning. Before anything is coloured or animated, the browser has to know what each part is: this is the page's title, this is a list of steps, this is a link to another page, this is the main content and that is the menu. HTML is the language that says so, and everything later in the book, from CSS to JavaScript to accessibility, stands on the structure written here. Chapter 1 gave you a page of about ten lines; this chapter explains every one of them and turns the page into a small site of three.

Six topics. The shape every element shares: tags, attributes, nesting and the skeleton of a page. Headings as an outline, paragraphs, lists and tables, and the forgiving parser that hides mistakes. Links and the paths inside them, with two new pages for your site. Images and the alt text that makes them usable by everyone. The landmark elements that name a page's regions. And DevTools, the browser's built-in workshop for seeing the page it actually built.

A page is a tree of labelled boxes
The root
html
About the page, not shown
head
Inside the head
title, meta
Everything that is shown
body
Landmark
header
Landmark
main
Content
h1, p, ul
Landmark
footer

Topics in This Chapter