Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
Understanding an HTML Tag.docx59 KB Understanding an HTML Tag - Solution.docx
59 KB
Quick reference
Understanding an HTML Tag
In this video we'll look at the basic structure of an HTML tag.
When to use
Most HTML tags have both a beginning and an ending tag, but some do not.
Instructions
HTML tags, or Elements, usually have both an opening and a closing tag. The closing tag will have the addition of a forward slash, for example:
<h1>This is a title</h1>
One tag that both opens and closes itself (without a closing tag) is the BR tag, which is a line break tag.
<br />
Common HTML tags include:
<head> The head tag is used for metadata, like your page title.
<title> The title tag is used for your page title. It is nested inside the head tag.
<body> The body tag is used for the body of your text on the page.
<h1> The h1 tag is used to define the largest (and therefore most important) heading on your page. There are other heading sizes you can use, <h2> <h3> <h4> <h5> <h6> , with h6 being the smallest, and therefore least important.
You can see the tags above used in the following example. Note how the title tag is 'nested' within the head tag.
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Hello World!</h1>
My name is John Elder
</body>
</html>
Hints & tips
- HTML Tags are also called Elements
- We'll usually refer to them as tags, not elements
- Most HTML tags both open and close
- Some tags don't close (or close themselves in their opening tag)
- One tag that closes itself is the <br /> line break tag.
Lesson notes are only available for subscribers.