Students put one tag inside another, close the last one opened first, and find out that the browser guesses silently when tags are missing or cross.
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 10 min · Investigate 12 min · Modify 8 min · Make 10 min
Read the unit primer "HTML structure in 5 minutes" first, then do the Make task yourself in the playground (about 5 minutes).
The idea: nesting. Tags go inside other tags like boxes inside boxes, so the tag opened last must be closed first. Turn on Boxes in the playground and every tag becomes a box, which shows the nesting.
Unlike Python, HTML never stops with an error. A missing or crossed tag gives a page that looks wrong, and the browser says nothing.
</strong> trace is the surprise: the bold runs on into the next paragraphs and no message appears.On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
On paper, write
, and for one sentence. Draw a box around each tag pair. Do any boxes cross?
Boxes that cross are the bug. Ask which closing tag has to move so every box sits inside another.
Closing tags in the right order. Turn on Boxes and ask which box is inside which, rather than correcting the tags.
| What you will see | A question to ask | The fix |
|---|---|---|
| Everything after one word is bold or slanted. | Which closing tag is missing? | Add the missing </strong> or </em> straight after the words it should cover. |
| Bold and slanted words stop in the wrong places. | Which tag did you open last, and did it close first? | Close in reverse order of opening, </em> then </strong>. |
| A tag shows on the page as text. | Does it have both < and >, and a slash if it is a closing tag? | Every tag needs both brackets, and a closing tag needs the slash. |
One possible solution for each task. Other correct programs are fine.
<h1>Sports day</h1>
<p>Bring <strong>a hat and <em>water</em></strong> on Friday.</p>
<h1>Sports day</h1>
<p>Bring <strong>a hat and <em>water</em></strong> on <strong><em>Friday</em></strong>.</p>
<h1>School trip</h1>
<h2>When</h2>
<p>The trip is on Tuesday. The bus leaves at <strong>8 am <em>sharp</em></strong>.</p>
<h2>What to bring</h2>
<p>Bring <strong>lunch</strong>, a hat and a <em>water</em> bottle.</p>
Stretch: Put <em> inside <strong> inside <p> inside nothing else, then draw the boxes on paper. Add a comment above each paragraph with <!-- -->.
Support: Give students the Modify starter and ask only for the first task: swap two closing tags. Use Boxes to show the boxes cross.
A student writes <strong>Friday <em>night</strong></em>. What is wrong, and what will the browser say?
The tags cross: <em> was opened last so </em> must come first. The browser says nothing; it makes a best guess and the page may look wrong.
Next lesson adds CSS: a rule can style every tag of one kind at once, and nesting is what lets it colour just the important words. Class idea: show a news website with the page source open and spot tags inside tags.