HTML elements: opening and closing tags

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

HTML elements: opening and closing tags

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which of these is a correctly formed closing tag?
A </h1>
B <h1/>
2. Where does the forward slash go in a closing tag?
A Before the tag name: </p>
B After the tag name: <p/>
3. True or false: <div> and </p> are a correctly matched pair of tags.
A True
B False
4. Which line shows a complete HTML element with opening tag, content, and closing tag?
A <p>Hello<p>
B <p>Hello</p>
5. True or false: content goes between the opening and closing tag.
A True
B False

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1<p>Hello</p> A<span>My text</span>
2</h1> B</div>
3Content goes between the opening and closing tag CThe closing tag name must match the opening tag - </h2> cannot close an <h1> element
4A closing tag uses a forward slash before the tag name DA closing tag - the forward slash before h1 signals the end of the heading element
5<p>Welcome<p> EA complete paragraph element - opening tag, content, and matching closing tag
6<h1>Title</h2> FThe second tag should be </p> - using <p> again opens a new element instead of closing the first

Definitions

</p>

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
<h1>Hello World___
2.
___<p>My paragraph</p>
3.
<p>Some text___
4.
<___>Page Heading</h2>
5.
<span>Bold text___

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A <h1 title</h1>
B <p>Some text</p>
C <span>Label</span>
Question 2
A <div>
B <p>Hello there<div>
C <span>More</span>
D </div>
Question 3
A <section>
B <h1>Title</h1>
C <p>Content<section>
D </section>
Question 4
A <div>
B <span>Label</span>
C <p>More text</p>
D <div>
Question 5
A <article>
B <h2>Heading</h2>
C <p>First paragraph</p>
D <p>Second paragraph</p>
E <article>

Answer Key

HTML elements: opening and closing tags
Section A: Quick Questions
Q1
A — </h1>
Q2
A — Before the tag name: </p>
Q3
B — False
Q4
B — <p>Hello</p>
Q5
A — True
Section B: Match the Pairs
Q1
<p>Hello</p> → A complete paragraph element - opening tag, content, and matching closing tag
Q2
</h1> → A closing tag - the forward slash before h1 signals the end of the heading element
Q3
Content goes between the opening and closing tag → <span>My text</span>
Q4
A closing tag uses a forward slash before the tag name → </div>
Q5
<p>Welcome<p> → The second tag should be </p> - using <p> again opens a new element instead of closing the first
Q6
<h1>Title</h2> → The closing tag name must match the opening tag - </h2> cannot close an <h1> element
Section C: Definitions
Q1
</p> — A closing tag - the forward slash before the tag name signals the end of an HTML element.
Section D: Fill in the Blanks
Q1
<h1>Hello World</h1>
Q2
<div><p>My paragraph</p>
Q3
<p>Some text</p>
Q4
<h2>Page Heading</h2>
Q5
<span>Bold text</span>
Section E: Spot the Error
Q1
A — The opening h1 tag is malformed - it is missing the closing angle bracket >. It should be <h1> not <h1 title.
Q2
B — The paragraph is closed with <div> instead of </p>. The closing tag must match the opening tag and use a forward slash.
Q3
C — The paragraph is closed with <section> instead of </p>. Closing tags must match their opening tag name and include a forward slash.
Q4
D — The closing tag for div is written as <div> instead of </div>. A closing tag must have a forward slash before the tag name.
Q5
E — The article element is closed with <article> instead of </article>. A closing tag requires a forward slash.