In our previous lesson, What Is HTML?, we learned that HTML uses HTML tags or special keywords that give instructions to web browsers on how to display a page. In this lesson, we’re going to learn the basics about what makes up an HTML tag.
All HTML tags are enclosed in the < and the > symbols. These symbols may be called the lesser-than and greater-than symbols; or, you may see them referred to as angle brackets (the left angle bracket and the right angle bracket). For example, the HTML bold tag looks like this: <b>, and the italics tag looks like this: <i>.
HTML Tags Usually Come in Pairs
Usually, HTML tags are used in pairs—an opening tag and a closing tag. These tags can also be called the start tag and the end tag. The closing tag looks just like the opening tag except that it has a forward slash right after the first angle bracket. For example, the closing bold tag looks like this: </b>, and the closing italics tag looks like this: </i>.
The part of the page affected by the tag will be between the two tags. Sound confusing? Lets look at the bold tag again. If you want a web browser to bold some text, then you have to put it between an opening bold tag and a closing bold tag. It will probably help to see what this looks like; so let’s look at an example:
| Example | |
|---|---|
| code | here is some plain text <b>here is some bold text</b> |
| results | here is some plain text here is some bold text |
A pair of HTML tags can contain not only text but also other HTML tags. For example, we could bold some text within some italicized text:
| Example | |
|---|---|
| code | <i>we can <b>bold some text</b> inside italicized text</i> |
| results | we can bold some text inside italicized text |
I’ll give you a few moments to recover from exposure to the sheer awesomeness that is HTML tags.
…
Enough with the HTML Tags…For Now…
Ready? Okay, looks you’ve had enough about HTML tags (for now) and that you’re ready to learn about HTML attributes.