Empty vs. Container Tags

Some tags simply tell the browser to display something - like the horizontal rule.

<hr width="50%">


These are called empty tags. Other tags tell the browser to do something to some content. For example, the bold tag tells the browser to display some text as bold. These are called container tags because they wrap around something - in this case, the text to be shown in bold. These tags have two parts, the opening tag and the closing tag.

i. The Opening Tag

The opening tag is structured as we've just seen, with opening bracket, tag, attribute(s), value(s) and closing bracket. All the attributes and their values are in this opening tag. This tag tells the browser "start doing something here" - for example, "start showing text in bold face here".

ii. The Closing Tag

The closing tag has some of the same parts as the opening tag. It has opening and closing brackets, and the tag. What it doesn't have are attributes or values. What it has that the opening tag doesn't is the the backslash ( / ). This tells the browser that this is a closing tag, and it should stop doing whatever it was told to do by the opening tag.

So, to tell the browser we want to show some text in bold, we use:

<b>Show this text in bold</b>, but not this text.

Which looks like this:

Show this text in bold , but not this text.

Now take a look at the source code (View-Document Source).



previous next contents