Control how a page is laid out, with boxes, Flexbox, Grid and components that repeat.
Each lesson works two ways. Students can work through the online tutorial at their own pace (it checks their answers and saves their progress in their browser), or you can teach it to the whole class from the slides, then send students into the tutorial for the Modify and Make steps.
Every lesson guide has plain-language notes, the answers to every check, a solution for every task, and slides and a worksheet for Waypoints Prepare. These guide pages are not linked from student pages, but they are not secret either: keep printed Teacher editions for answers you do not want students to find.
Whole-course cheat sheet: Open to print (every command, grouped by unit: a handout for the final challenge)
Which rule wins, and how to style only the links in a menu.
A CSS rule is a selector and a list of property: value; pairs in braces. Two things can happen at once, and students need to know both.
First, an element takes the properties of every rule that matches it. A paragraph with class="note" matches p { } and .note { }, so it gets both rules' properties. Only when two rules set the same property does one have to win. Then a class rule beats a tag rule, and between rules of equal strength the later one wins.
Second, you can save typing. A group selector puts a comma between selectors, h1, p { color: navy; }, so one rule styles both. A space is different: nav a { } means "a link inside a nav", so it styles the menu links and leaves other links alone.
nav a is how every site styles its menu without touching other links.School rules: "everyone wears uniform" (a tag rule) and "the netball team wears red" (a class rule). A netball player follows both, and where they clash, the more specific rule wins. Where it breaks: if two rules are equally specific, school has a person to decide; CSS just takes the later one.
p { color: teal; font-size: 20px; } and .note { color: crimson; }. Give one paragraph class="note". Is it teal, crimson, 20px?p { color: green; } below the first. Which paragraphs turn green? Why?h1 and h2 into one rule with a comma.<nav> and one in a paragraph. Write nav a { text-decoration: none; }. Which links change?h1, p and nav a?" A comma means "and". A space means "inside".nav { color: white; } is set, why are the links not white?" Links have their own colour rule from the browser. Name the links: nav a { }.Rules that combine come first in Course B, and nav a styles the menu links. Block and inline boxes come next, then the layout lessons use class rules and nav a again. The final challenge needs all of it.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Block and inline, and every element as a box: padding, border and margin.
The browser draws every element as a box. Some boxes are block: <p>, <h1> and <div> start a new line and stretch across the page, so they stack. Others are inline: <strong>, <a> and <span> sit inside the line of text, side by side. <div> and <span> do nothing by themselves; they are plain boxes (block and inline) you wrap around things to style them. display: block or display: inline switches a box from one kind to the other.
A box has layers. Content is the text or picture. Padding is room inside, between the content and the border. The border is the line around it. Margin is space outside the border, pushing other boxes away. width sets only the content, so the width on the page is the width plus padding and border on both sides.
width that does nothing on a <span>, or a card wider than you set, both come from the box rules.<div> with a class lets you style a group of things as one.A framed picture on a wall: the picture is the content, the mat around it is the padding, the frame is the border, and the gap to the next frame is the margin. Where it breaks: a frame's size usually includes its mat, but in CSS width is the picture only, so the padding and border add to it.
<strong> and <a> in a page. Which items stack, and which sit in the line?<div class="box">. What changes? (Nothing, until a rule styles .box.).box a border: 2px solid navy;. Then add padding: 16px;. Watch the text move away from the line.margin: 24px;. Which way does the whole box move?width: 200px; then add padding: 20px. Measure the box: 240px, not 200px, plus the border.<span> a width. Nothing happens. Add display: block.width. Make it block.width.<div> not change anything?" A <div> has no look of its own; it needs a rule.Block and inline come before the box model. A box with padding, a border and a width becomes a card, which the layout unit copies and puts in rows.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Rows with Flexbox, spacing, wrapping to fit any width, and components you copy.
Normally boxes stack down the page. Flexbox puts them in a row. Put display: flex; on the box that holds the items (the parent), and its children sit side by side. It goes on the holder, never on the items.
Three more properties tidy the row. gap sets the space between items. justify-content says where the items sit along the row (flex-start, center, space-between). align-items says how they line up across it (center lines up different heights). flex-wrap: wrap lets items drop to a new line when the row runs out of room, and flex: 1 with a min-width lets items share the row without squashing.
A component is a chunk of HTML with a class that you copy. One set of rules styles every copy, so adding a card means copying HTML, not writing CSS.
A shelf: the shelf is the parent, the books are the items, and you decide how they sit along it and how they are spaced. Where it breaks: a real shelf has a fixed length. A wrapping row starts a new shelf when the first is full.
<ul> of three links in a <nav>. Add nav ul { display: flex; }. The list becomes a row.gap: 16px;, then try justify-content: space-between; and center.<h1> and the nav. Put display: flex; justify-content: space-between; on the header.<div class="card"> in a <section class="cards">. Add display: flex; flex-wrap: wrap; gap: 16px; to .cards..card flex: 1; min-width: 200px;. Make the window narrow. Copy a card: a fourth appears with no new CSS.display: flex and nothing moved." It is on the items. Move it to the box that holds them.justify-content and align-items?" Along the row, and across it.flex-wrap: wrap and a min-width, a row shrinks its items..card1, .card2?" No. One class on every card.Flexbox follows the box model: a row is boxes with padding, border and gap. The final challenge puts the club page's header, hero and cards in rows. An optional lesson adds Grid for rows and columns at once.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Lay out the club page from Structure and style a page. Two optional lessons go further: Grid, and a little JavaScript.
The Course B challenge lays out the club page from Course A. There is nothing new in it. Students work in three milestones, and the support fades: the first gives the exact code, the second an outline as comments, the third only the goals. Then they make it their own.
nav ul), links styled with nav a.The starter is the finished Course A club page, so a student who skipped Course A can still begin. Finishing the core lesson marks Challenge complete on the course page. Two optional lessons go further: Grid lays out rows and columns together, and Make it react adds JavaScript as a recipe.
Decorating a room you have already built: the walls are up, and now you arrange the furniture. Where it breaks: you cannot see a room from the plans, but with CSS, every change shows up straight away. Use that, and check after every change.
display: flex go?" On the box that holds the items. In the header that is the header, and for the links it is the nav ul.display: flex.flex-wrap: wrap, and the card needs a min-width.The challenge reviews every move in both courses. Ask students to name three parts of the page and the rule behind each. After it, the optional Grid lesson, and then Bootstrap, the DOM course and a site of their own, build on this page.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Self-paced briefs students can pick up after the lesson named on each. Students tick their own milestones and claim a badge; the page lights the skills their code uses. Badges stay in the student's browser: ask them to press Show your teacher. Open the projects page
Make a recipe card for something you can cook or make: the ingredients in a table with amounts, the steps as a numbered list, and CSS that makes it look like a card (a border, padding, a background).
Milestones:
<style>
.card { width: 320px; border: 2px solid #c2570a; padding: 16px; background: #fff7ef; font-family: sans-serif; }
th, td { padding: 4px 10px; text-align: left; }
th { background: #c2570a; color: white; }
</style>
<div class="card">
<h1>Pancakes</h1>
<table>
<tr><th>Ingredient</th><th>Amount</th></tr>
<tr><td>Flour</td><td>1 cup</td></tr>
<tr><td>Milk</td><td>1 cup</td></tr>
<tr><td>Egg</td><td>1</td></tr>
</table>
<h2>Steps</h2>
<ol>
<li>Whisk everything together.</li>
<li>Pour a little into a hot pan.</li>
<li>Flip when bubbles appear.</li>
</ol>
</div>
Make a page for a real or made-up event (a sports day, a concert, a games club): a header, a menu of sections, three cards side by side with what is on, and a footer.
Milestones:
<style>
body { font-family: sans-serif; margin: 0; }
header, footer { background: #1d2430; color: white; padding: 12px 16px; }
nav a { color: #ffb26b; margin-right: 12px; }
.cards { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px; }
.card { flex: 1; min-width: 120px; border: 1px solid #ccc; border-radius: 10px; padding: 12px; }
</style>
<header>
<h1>Games Club Night</h1>
<nav><a href="#on">What's on</a><a href="#when">When</a></nav>
</header>
<main>
<section id="on" class="cards">
<div class="card"><h2>Chess</h2><p>Beginners welcome.</p></div>
<div class="card"><h2>Card games</h2><p>Uno and more.</p></div>
<div class="card"><h2>Video games</h2><p>Bring a friend.</p></div>
</section>
</main>
<footer id="when">Friday, 4 pm, Library</footer>