J. M. Pressley
Music |  Writing |  Travelogues |  Shakespeare Resource Center |  Contact

Introduction | Required Tags | Formatting, Part I | Formatting, Part II | Links | Lists | Tables | Images | Other Resources

Required Tags

You learned in the introduction that tags are required to format HTML documents for the browser. The standard format goes like this:

<TAG>content</TAG>

Let's build on this. Specific tags have specific jobs in HTML. The following example is a bare bones structure for making an HTML document that's ready to be displayed:

<HTML>
  <HEAD>
    <TITLE>Title of Document</TITLE>
  </HEAD>
<BODY>
Contents of Page
</BODY>
</HTML>

Notice how everything is done in the paired <TAG>content</TAG> format we've discussed. This is the foundation of a Web page, with the elements discussed below:

<HTML>
</HTML>
This tag pair defines the page as an HTML document so that the browser application recognizes it and knows how to display it. The open tag should be the very first line of any HTML document, and the closing tag should be the very last. Anything appearing outside of these tags will either be displayed improperly or not at all.
<HEAD>
</HEAD>
The <HEAD> tags enclose information about the document itself (e.g., the title, explained below). This is information that is not displayed in the page; the only element discussed in this tutorial is <TITLE>, which always goes in between the <HEAD> tags.
<TITLE>
</TITLE>
Title is fairly self-explanatory: this is the document's title, which gets displayed in the top of browser window. For example, the <TITLE> of this page is "Practical HTML Primer - Required Tags."
<BODY>
</BODY>
The material between the <BODY> tags is what is displayed on the screen by the browser application. This is where your text would go, along with any additional formatting tags (described in the next lesson).

Incidentally, this is a good time to talk about the concept of nesting. Nesting is when one or more tag pairs occur inside of another tag pair; for instance, every tag in a Web page is nested inside of the <HTML> tags. Notice that the <TITLE> tags are completely enclosed within the <HEAD> tags? That's proper nesting—don't close a set of tags before closing any tag pairs that are inside them. Keep the closing tags in their proper order.

Improper Nesting:

<HEAD><TITLE>Title of Document</HEAD></TITLE>

Proper Nesting:

<HEAD><TITLE>Title of Document</TITLE></HEAD>

Just remember to close nested tags from the inside out.

So, that's it, right? Not quite. What the above lesson has done is to give you an understanding of the skeleton of an HTML document. (For an example of what the above document would look like, click here.) Sure, the document will be recognized, but what if we have a lot of text to publish? What about formatting? Let's take the previous example:

<HTML>
  <HEAD>
    <TITLE>Title of Document</TITLE>
  </HEAD>
<BODY>
Contents of Page
</BODY>
</HTML>

We're going to modify this document a little, giving it a title and some sample text:

<HTML>
  <HEAD>
    <TITLE>The Gettysburg Address</TITLE>
  </HEAD>
<BODY>

Four score and seven years ago our fathers brought forth on
this continent a new nation, conceived in liberty and dedicated
to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that
nation or any nation so conceived and so dedicated can long
endure. We are met on a great battlefield of that war. We have
come to dedicate a portion of that field as a final resting place
for those who here gave their lives that that nation might live.
It is altogether fitting and proper that we should do this.

But, in a larger sense, we cannot dedicate--we cannot 
consecrate--we cannot hallow--this ground. The brave men, living 
and dead, who struggled here have consecrated it far above our poor 
power to add or detract. The world will little note nor long remember
what we say here, but it can never forget what they did here. It
is for us, the living, rather, to be dedicated here to the
unfinished work which they who fought here have thus far so nobly
advanced.

It is rather for us to be here dedicated to the great task
remaining before us--that from these honored dead we take
increased devotion to that cause for which they gave the last
full measure of devotion; that we here highly resolve that these
dead shall not have died in vain; that this nation, under God,
shall have a new birth of freedom; and that government of the
people, by the people, for the people shall not perish from the
earth.

</BODY>
</HTML>

The document, when saved, will appear to the browser as an HTML document, but with a slight problem, as demonstrated below:
(For the actual example page, click here.)

Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation or any nation so conceived and so dedicated can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we cannot dedicate--we cannot consecrate--we cannot hallow--this ground. The brave men, living and dead, who struggled here have consecrated it far above our poor power to add or detract. The world will little note nor long remember what we say here, but it can never forget what they did here. It is for us, the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us--that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion; that we here highly resolve that these dead shall not have died in vain; that this nation, under God, shall have a new birth of freedom; and that government of the people, by the people, for the people shall not perish from the earth.

At this point, the attentive learner should be asking, at the very least, "Hey—where are my paragraph breaks?" Well, we literally didn't say that we wanted paragraph breaks or any other kind of formatting done to the text. All we've done to this point is tell the browser that we want to display a document; we haven't told it how to display the document yet. More on the Gettysburg Address in our next lesson, Formatting, Part I.


Top | Home