Tags: opening, content, closing
A web page is made of parts, and every part is wrapped in a tag. A tag has three pieces. First, the opening tag, for example <p>, which says ‘a paragraph starts here’. Second, the content, which is the text people will read. Third, the closing tag, for example </p>, which looks like the opening tag but has a slash and says ‘the paragraph ends here’. Think of a parcel: the first label says ‘open here’, the thing is inside, and the last label says ‘end of parcel’. The browser reads the tags to decide how to show the content, but it does not show the tags themselves. If a closing tag is missing, the browser may carry on and make the rest of the page look wrong, like a parcel with no end. Tags can also hold others: a bold word can sit inside a paragraph.
| Part | Example | Job |
|---|---|---|
| opening tag | <p> | starts the paragraph |
| content | Kites fly high. | the text people read |
| closing tag | </p> | ends the paragraph |
1<p>Kites fly high.</p>Kites fly high.
1<p>This is <b>very</b> important.</p>This is very important.
1<h1>Camels 2<p>They live in deserts.</p>
[big text for everything after the heading]
Tag detective. On paper, write three short lines of HTML that each use p tags: a sentence about the Nile, a sentence about your school, a sentence about your favourite food. Circle every opening tag in blue and every closing tag in red. Swap with a partner and look for a missing slash.
1<p>Hello Egypt</p>