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.
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.
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.
<title>My First Web Page</title>
My name is John Elder
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.