Structure of an HTML Document
An HTML document requires 3 tags in order to
be displayed correctly.
<HTML> - This tag always begins the
document. This tells the browser that everything below it
(until the /html) is going to be in html format.
<HEAD> - This is the heading of the
document. This is where information such as the title of the
web page, the name of the creator, etc. is seen. Nothing in
the <HEAD> tag seen by the user viewing the page.
<BODY> - This is where the body of the
document is located. All text and graphics are contained
within the <BODY> tag.
Here is how the standard HTML hierarchy
works:
<HTML>
<HEAD>
</HEAD>
<BODY>
<B>My home page</B>
</BODY>
</HTML>
The <HEAD> Tag
As stated before, the <HEAD> tag contains
information not necessarily seen by the user. The only tag
ever contained in the HEAD tag that would be seen by the
user is the TITLE tag, which displays the title of the page
on the top of most browsers.
There is plenty of other information that
can be stored there:
-
Name, description and keywords of the document. This
information is used mostly for search engines, such as
Yahoo or Lycos.
-
Define relationships between other documents.
-
Define a script function, which is far too advanced to
cover in this tutorial.
The TITLE tag, as I mentioned, is where the
name of the document is stored. This displays on the top of
the browser window.
Here is an example of how the TITLE tag is used:
<HTML>
<HEAD>
<TITLE>My home page</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
As mentioned, there are several tags one can
include in the <HEAD> container that will determine how the
page is displayed on a search engine. This is done with
<META> tags. The 2 most widely used <META> tags are
DESCRIPTION and KEYWORDS. The META tag is a way for the
creator of the page to define information that is not
included in the HTML document. Many meta features are
advanced, and will not be discussed in this tutorial. Only
the DESCRIPTION and KEYWORDS elements will be discussed.
Here is how one would include a description
of the document:
<META NAME="Description" CONTENT="My name is
Aaron and this is my home page. Come on by and see what I'm
like.">
The Name field is how the tag is defined,
and the Content field is where the information is kept. If
this page were registered in a search engine, the title
would be displayed as: 'My home page.' The description of
the page would be displayed as: 'My name is Aaron and this
is my home page. Come on by and see what I'm like.'
Meta tags do not require that you close them
with a </> tag. They are not container tags.
The Keywords determine what searchable words
could find your site. If you created a gardening site, you
would probably use 'garden' as one of your keywords. Here is
how Keywords are defined:
<META NAME="Keywords" CONTENT="home page,
me">
If anyone used the words 'home page' or 'me'
to search for a page, this page might be one of the search
results. Naturally you have to think logically when it comes
to keywording your page. Few people are going to search with
the word 'me.'
Here is how the page looks with the META
commands included.
<HTML>
<HEAD>
<TITLE>My home page</TITLE>
<META NAME="Description" CONTENT="My name is Aaron and this
is my home page. Come on by and see what I'm like.">
<META NAME="Keywords" CONTENT="home page, me">
</HEAD>
<BODY>
</BODY>
</HTML>
I hope this came in useful!
Ask in the forum
if you have any suggestions or comments.