HTML and CSS, from one file to a page you can send someone

CodeWithPurpose lessons that build one real page by hand and explain the browser underneath it. Twenty-four chapters: elements, semantic markup, the cascade, the box model, flexbox, grid, accessibility, and publishing. No framework, no build step.

Student writing HTML on a laptop

2. The Language of Structure

7 chapters

Every element you will actually use, what each one means, and why the tag you choose is a claim about content rather than a choice of appearance.

HTMLInteractive

Elements, Tags, and the Ones That Never Close

An element, a tag, an attribute, and a value are four different things that everybody calls tags. Take one line of HTML apart piece by piece, and meet the handful of elements that have no closing tag at all.

10 min read

HTMLInteractive

The Skeleton Every Page Has

Every page on the internet starts with the same eight lines, and each one is doing a job you can name. Then see the same markup as a tree, because that is what the browser turns it into and what CSS selects from.

11 min read

HTML

Marking Words Up So They Mean Something

There are six heading levels and they are an outline, not six font sizes — using h3 because it looked right is the single most common HTML mistake. Learn what each text element claims, and which two look identical and are not.

10 min read

HTML

The Two Elements That Made the Web

A link and an image are the whole reason the web is a web rather than a pile of documents. Both are one tag with one critical attribute — and both have a second attribute people skip that decides whether the page works at all.

11 min read

HTML

Data That Has Shape

Lists are the most-used element on the web and most of them are not visibly lists. Tables are the most-abused element in its history. Learn what each is for, and the one rule that decides between them.

10 min read

HTML

Asking the Visitor for Something

A form is the only part of HTML that sends data anywhere, and one unlabelled input is the difference between a usable form and an unusable one. Meet the input types that give phones the right keyboard for free.

12 min read

HTML

div Is the Last Resort, Not the First

A div says nothing about its contents, and a page built from thirty of them is invisible to a screen reader, a search engine, and reader mode alike. Swap them for the elements that mean something and lose nothing at all.

11 min read

3. The Language of Presentation

5 chapters

Getting styles onto a page, choosing what they apply to, and the two mechanisms — the cascade and the box model — behind most of what confuses people.

Open source

Your chapter goes here

Every chapter here was written by a student. Propose your own topic, or fix one that confused you. Drafts stay invisible until they are ready, so nothing you start can break the site.

The first thing you build is a page somebody can open

These lessons are part of CodeWithPurpose's free learning library, built by students, for students, everywhere.