<html> Topic 4

Nested Tags Are Like Nested Boxes

 

What does it mean to "nest tags" in HTML? This does not mean just taking good care of your tags, like a mother bird watches her eggs in a nest.

Imagine opening a big gift box only to find another gift box. When you open the second box, you find yet another gift box. Finally, when you open the smallest box, you find the gift inside. We might call these "nested boxes" enclosing your gift.

Now imagine that the gift represents the word or words that you are enclosing in html tags.

Let's begin by adding a set of <em> and </em> tags to make a word emphasized with italics. First you add that around the word.

Next, let's add another set of tags to make the emphasized words red. We add these <font color=red> and closing </font> tags on the outside of the original <em> and </em> tags.

Finally, let's turn these words into a big heading. To do that, add the <h1> and </h1> tags on the outside of the other emphasis and font color tags. If you code:

<h1><font color=red><em>Words</em></font></h1> you will have a large red heading emphasized, usually in italics.

Open and close each set of tags just as you would keep a box with its lid for nested boxes.

Which of the two following sets of code is correct?

Choice 1:

<h1> <em> Words </h1> </em>

Choice 2:

<h1> <em> Words </em> </h1>

If you selected Choice 2 you were correct! The tag that is opened first is closed last.

 

Flash 4 Version

You are HereAbout Nested Tags

 

Readings
Resources
<head>
<p>
<b>
<li>
<a href>
<img src>
Access
<table>
<frame>
<style>
<form>
<script>
<object>
validate

Instructor: dwang@think-ink.net

Copyright by Diane Wang, 1999, 2000. All rights reserved.

Valid HTML 4.0!