Although by far the most common header element, <TITLE> is not the only tag which is allowed in the header of an HTML document. There are other tags, though most of them are not very popular. The two which are perhaps the least unpopular are discussed below.
This tag goes into the HEAD element of an HTML document, right next to the title tags. The actual tag is BASE, and its single attribute is HREF. The value of HREF should be the URL of the document which contains the BASE tag. For example, the markup for this chapter starts out:
<HTML> <HEAD> <TITLE>Chapter 3: Even More Header Elements</TITLE> <BASE HREF="http://www.cwru.edu/help/interHTML/ch3.html"> </HEAD>
The Web browser uses the value of HREF= (that is, the URL which is specified using that attribute) to resolve any partial URLs within the document itself. Therefore, the anchor <A HREF="examples/ch3ex1.html"> would be translated by the browser into http://www.cwru.edu/help/interHTML/examples/ch3ex1.html. The browser does this by discarding the ch3.html from the BASE HREF and adding examples/ch3ex1.html to what's left.
Use of the BASE tag is not required. If a document does not contain a BASE tag, the URL used to access the document is used instead.
So why use it at all? BASE HREF can be very useful if you are mirroring a page which is part of a larger set of pages, because it keeps relative (partial) URLs from breaking. If you were to copy a document to your hard drive, for example, and then load it into a Web browser, all partial URLs within the document would refer to (non-existent) files on your hard drive. Image references might also be invalid. If the copied document contains a BASE HREF, however, then partial URLs will be resolved as full URLs for the server from which the page came.
In other words, by using the BASE HREF tag, you can fool the Web browser into thinking that the page it just loaded came from someplace other than from where it was actually retrieved.
As I said, this tag's use is strictly optional, and in most cases not at all necessary. I personally use it rarely, if at all.
Okay, suppose that you want to imbed information about your document which doesn't fit into any of the defined HTML tags. For example, let's say that you want to "sign" your Web pages. There isn't any such thing as an AUTHOR tag, so that's out. You could put your name in the text of the page itself, but suppose that for some reason that doesn't really appeal to you. (Assume that you're modest-- I know, it will be a stretch for some of you. It certainly was for me.)
There is a way, of course, to do this; otherwise, I probably wouldn't have brought it up in the first place. Using the <META> tag, you can include information which would ordinarily have nowhere to go.
<META> is an empty tag, so there is no </META> required (or available, for that matter). <META> has three possible attributes: NAME, and CONTENT, HTTP-EQUIV.
We'll stick with the author-name example for the moment. If I were to add such a tag to this page, the HTML at the top would look like this:
<HTML> <HEAD> <TITLE>Chapter 3: Even More Header Elements</TITLE> <BASE HREF="http://www.cwru.edu/help/interHTML/ch3.html"> <META NAME="Author" CONTENT="Eric A. Meyer"> </HEAD>
Authors are not limited to one META tag per file. There is absolutely nothing wrong with adding multiple META tags, and it may be a good idea to do so in some cases. For example:
<HTML> <HEAD> <TITLE>Chapter 3: Even More Header Elements</TITLE> <BASE HREF="http://www.cwru.edu/help/interHTML/ch3.html"> <META NAME="Author" CONTENT="Eric A. Meyer"> <META NAME="Keywords" CONTENT="HTML,tutorial,headers,base,href,meta"> <META NAME="Expires" CONTENT="31 December 1996"> </HEAD>
The three tags define the author's name, a number of keywords which could be used by a search engine, and the document's expiration date; that is, the date on which the document is defined to become obsolete. ("HTML-- now with Freshness Dating!")
There is no theoretical limit to the number of META tags which can be added to the file. However, there are certain types of information which should not be represented in META tags.
The thing to avoid the most is the use of META tags to represent information which should be contained in pre-defined tags. For example, the document's title should not be placed into a META tag, because that information belongs in the TITLE container. Therefore, the tag...
<META NAME="Title" CONTENT="Chapter 3: Even More Header Elements">
...would be illegal. So, too, would be a META tag containing the document's base HREF, since that should go into the BASE HREF tag.
Note that use of the META tag only makes sense under limited circumstances. Nearly every browser in existence will cheerfully ignore META tags, and servers will do something with them only if specifically instructed to do so. Therefore, unless you have clear evidence to the contrary, you can assume that you don't need to include META tags in your documents.
That's right-- forms! It is very important that you read and understand the next chapter. It will give you both forewarning and preparation for the subject of forms.
Chapter 3 Quiz
Next-- Chapter 4:
Forms Theory
Table of Contents
Tutorial Glossary
Tutorial Index
The HTML
Laboratory