← Teacher guide

Tags label text

Students label text with headings and paragraphs, and find out that the browser ignores line breaks in the code.

Structure and style a page · Text and style · about 40 minutes · Open the student lesson

Classroom resources

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.

Students will be able to

Timing

Predict and Run 10 min · Investigate 12 min · Modify 10 min · Make 8 min

Before class

Read the unit primer "HTML structure in 5 minutes" first, then do the Make task yourself in the playground (about 5 minutes).

The surprise for students: pressing Enter in the code does not make a new line on the page. Only a new <p> does. A tag is a label in angle brackets, like <p>. Most tags come in pairs: an opening tag <p> and a closing tag </p> with a slash, wrapped around the text they label.

Running the lesson

  1. Predict and Run: most students say 4 lines. The page shows 2, because the browser joins the lines of one paragraph. Let them press Enter in the code and see that nothing changes, then add a <p>. Ask one pair from each answer to say why. Most will say 4: that is the idea the lesson turns around.
  2. Investigate: the match task is about meaning, not looks: <h1> means the main heading. The one-line question is the key idea, that the tags decide and not the lines of code.
  3. Modify and Make: one change at a time, check the page each time. The Make check ticks when the page uses <h1>, <h2> and <p>.

In class

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.

The hard part (on purpose)

Seeing that line breaks in the code do nothing. Let the Predict surprise land, and ask which tag starts a new line rather than fixing it.

When students get stuck

What you will seeA question to askThe fix
Text the student typed on a new line runs on from the line before.Which tag starts a new paragraph?Wrap each paragraph in its own <p> and </p>. Pressing Enter in the code does not change the page.
A tag shows on the page as text, such as <h2 or h2>.Does every tag have both of its angle brackets?Every tag needs < and >, and a closing tag needs the slash, as in </h2>.
Everything after a heading is big and bold.Where does the heading end?Add the missing closing tag, such as </h2>, straight after the heading words.

Answers to the checks

  1. Predict: How many lines of normal text (not counting the heading) will the page show?
    2 lines. The browser ignores line breaks in the code, so the three lines of the first paragraph join into one. Each <p> starts a new paragraph.
  2. Match the parts: Match each part of the page with its job.
    <h1>Sports day</h1> → A. the main heading of the page; <h2>What to bring</h2> → B. a heading for one section; <p> … </p> → C. a paragraph
    Each tag says what its text is. The browser chooses the look: big and bold for headings, plain text with a gap for paragraphs.
  3. One line of code: A page has <p>Bring a hat.</p><p>Bring water.</p> all on one line of code. How many paragraphs does the page show?
    2, because there are two <p> tags
    Tags decide, not lines. Two <p> tags make two paragraphs, even when they are on one line of code.
  4. Sam's notice: Sam wants Bring a towel. and Races start at 9 am. on separate lines, but the page shows them on one line. Click the line that causes it.
    line 4
    Line 4 starts a new sentence inside the same paragraph, and the browser ignores the break in the code. End the paragraph with </p> and start the next with <p>.

Solutions

One possible solution for each task. Other correct programs are fine.

Modify › Change the event

<h1>Swimming carnival</h1>
<p>The swimming carnival is on Thursday. Bring a towel.</p>

Modify › Two paragraphs

<h1>Swimming carnival</h1>
<p>The swimming carnival is on Thursday.</p><p>Bring a towel.</p>

Modify › Add two sections

<h1>Swimming carnival</h1>
<h2>When</h2>
<p>The swimming carnival is on Thursday.</p>
<h2>What to bring</h2>
<p>Bring a towel.</p>

Make

<h1>Spring concert</h1>
<h2>When and where</h2>
<p>The concert is on Wednesday at 6 pm in the hall.</p>
<h2>Who is playing</h2>
<p>The Year 7 band, the choir and the string group.</p>

Stretch and support

Stretch: Add a third section with an <h2> heading, and try <h3> and <h4> to see what the heading numbers do.

Support: Give students the Modify starter and ask them only to change the words between the tags, then add one <h2>. Point to the Reference drawer for each tag.

Exit ticket

A student presses Enter in the middle of a paragraph in their code, but the page does not change. Why, and how do they start a new line?

The browser ignores line breaks in the code. To start a new paragraph, end the first with </p> and start the next with <p>.

What each step is for

Where it leads

Next lesson puts tags inside other tags, so a word can be important inside a paragraph, and finds out what the browser does when a tag is missing. Class idea: show a news website and ask students to spot the headings and paragraphs.