You are on page 1of 8

[Contents] <contents.htm> [Previous] <tags2.htm> [Next] <tags4.

htm> [Alphabetical
Tag List] <alphlist.htm> [Index] <tagsix.htm>

HTML Tag Reference

Heading Tags
This section describes the tags that can go in the header of a document between the
<HEAD> and </HEAD> tags.

· TITLE <tags3.htm>
· BASE <tags3.htm>
· META <tags3.htm>
· STYLE <tags3.htm>
· LINK <tags3.htm>
Additionally, the ISINDEX <tags10.htm> and SCRIPT <tags13.htm> tags can go in the
header of a document, and these are discribed in other part of this document.

TITLE
(document title)
The TITLE tag specifies the title of the document. This title appears in the title bar of the
browser window. In addition, automated web search tools can use the title to index
documents. If no title is specified, the default title depends on the browser being used.

Syntax
<TITLE>...</TITLE>

Used within
HEAD

Example

<HTML>
<HEAD>
<TITLE>HTML Tag Reference</TITLE>
</HEAD>

BASE
(base URL)
The BASE tag specifies the base URL for the document. All relative links in the
document are derived from this base URL. For example, if the base is
"http://home.netscape.com/" , the relative link "doc1.html" resolves to
"http://home.netscape.com/doc1.html" .
The BASE tag can also specify a base window which is used to display destination
documents when the user clicks links in the document (unless the link itself specifies a
target window).
When building complex, multi page documents, you might want to specify a base URL
for the main document (master HTML file). To do this, establish a base URL, then give
relative URLs for all referenced documents.
If you change the location of the master document, you must update the BASE tag to the
new base URL. All relative references to URLs will be updated relative to the new
location of the base URL.
If a document containing links to other documents in the same directory or a subdirectory
does not specify a base URL, the full path to the linked documents will usually be
resolved correctly. However, the browser may sometimes resolve relative links
incorrectly unless the document containing the links specifies the BASE attribute.
The BASE tag does not require a closing tag.

Syntax

<BASE
HREF="baseURL"
TARGET="WindowName"
>
The HREF attribute is required.

HREF="baseURL"
specifies the location of the document. This value should be a full path name. All
relative links in the document are resolved with respect to this base URL.

TARGET="windowName"
identifies the default window or frame to be used to display any documents that
are opened by activativing links in this document. Navigator 2.0

Used within
HEAD

Example
This example sets "http://home.netscape.com/" as the base URL for the document.

<HEAD>
<BASE HREF="http://home.netscape.com/">
</HEAD>
<BODY>
<P>Information about Netscape and its products can be found at
<A HREF="comprod/index.html">Company & Products</A>.
META
(metadocument information)
The META tag specifies information about the document or creates an HTTP response
header. The META tag has no effect on the appearance of the web page. It is intended for
use by other programs, such as search engines or web browsers.
If the NAME attribute is supplied, the META tag specifies information about the
document. You can use the META tag to convey information about the page to search
engines. For example, you could create a META tag that summarizes the content of the
page and another one that lists the important concepts or keywords in the page.
If the HTTP-EQUIV tag is supplied, the META tag creates an HTTP response header that
can convey information to the browser about what to do with the file. For example, you
can use the META tag to tell the browser how often to refresh the page. For example, you
could specify that a web page that displays stock prices or late-breaking news updates
automatically every five seconds without the user having to request it to update.

Syntax
<META
NAME="name"
HTTP-EQUIV="FieldName"
CONTENT="value"
>
You must provide either the NAME or the HTTP-EQUIV attribute.

NAME="name"
specifies a name for the metadocument information. Different programs that
access metadocument information expect different values for this attribute.
Widely recognized names include:
Description: A short, plain language description of the document. This is used by
search engines to describe your document. If your document has very little text, is
a frameset, or has extensive scripts at the top, you can use this tag to provide a
description of a page for search engines. For example:

<META NAME="description" CONTENT="Reference listing of HTML


tags.">
Keywords: Comma-separated keywords to be used by search engines to index
your document in addition to words from the title and document body. For
example:

<META NAME="keywords"
CONTENT="HTML, tags, reference, attributes">
Author : Usually the author's name.

HTTP-EQUIV="FieldName"
specifies the name of the HTTP response header field. Widely recognized values
include:
Expires: The date and time after which the document should be considered
expired. An illegal date, such as "0" is interpreted as "now." Setting the Expires
attribute to 0 may thus be used to force a modification check at each visit. Dates
must be given in RFC850 format, in GMT. For example:

<META HTTP-EQUIV="expires" CONTENT="Sun, 28 Dec 1997 09:32:45


GMT">
Refresh: Specifies a delay, in seconds, before the browser automatically reloads
the document. Optionally, specifies an alternative URL to load. For example:

<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http:nextdoc.html">


Set-Cookie: Sets a cookie in Netscape Navigator. Values with an expiration date
are considered permanent and are saved to disk on exit. For example:

<META HTTP-EQUIV="Set-Cookie"
CONTENT="cookievalue=abc;expires=Friday, 31-Dec-99 23:59:59
GMT; path=/">
For more information about cookies in general and the set-cookie value, see
<http://www.netscape.com/newsref/std/cookie_spec.html> .

CONTENT="FieldContent"
provides content information. Navigator 1.1.
If the NAME attribute is supplied, the CONTENT attribute specifies the content
or description. For example, if the NAME attribute is author, the CONTENT
attribute would be the author's name, such as Nikki Netscape. If the
HTTP-EQUIV attribute is given, then the CONTENT attribute specifies necessary
information for the HTTP header. For example, if HTTP-EQUIV is set to refresh,
then the value of the CONTENT attribute should be a string that specifies how
often to refresh the page, optionally including the URL to show next time the page
is refreshed.
The value of the CONTENT attribute is always a single string. If the
HTTP-EQUIV attribute requires multiple attributes itself, the value of the
CONTENT attribute must be a string containing all the attributes and their values
separated by semicolons. If any of the subattributes is a string, use single
quotation marks as the inner string delimiter. For example, if the HTTP-EQUIV
value requires three attributes, the value of the CONTENT attribute would be a
string such as:

CONTENT="firstvalue;secondval=`a string';thirdval='another
string';"

For more information about the META tag, see:

<http://www.stars.com/Seminars/HTML/Head/meta.html>
For details of many more values for the NAME and HTTP-EQUIV attributes, see:
<http://vancouver-webpages.com/META/>

UsedWithin
HEAD

Example 1: Indexing Information


In this example, the META tag stores indexing information that a search engine can use
when it accesses the document. Many search engines look for a META tag whose name is
"keywords" and will catalog the keywords.

<HEAD>
<TITLE>HTML Reference</TITLE>
<META NAME="keywords"
CONTENT="HTML, documentation, reference, Netscape">
</HEAD>
Any search engines that explore this page will index it under the terms HTML,
documentation, reference, and Netscape.

Example 2: a Special HTTP Header


In this example, the META tag creates a special HTTP header field called
"Creation_Date." The server returns this field when an HTTP connection for this
document is established.

<HEAD>
<META NAME="Creation_Date" CONTENT="July 17, 1997 19:24:00">
</HEAD>
This example creates the following HTTP header field:

Creation_Date: July 17, 1997 19:24:00

Example 3: Automatically Updating a Web Page


In this example, the META tag creates a special HTTP header field that implements a
client pull animation. The animation shows three different views of a dog; these views,
when loaded sequentially, simulate the dog running. The HTTP-EQUIV attribute is
"refresh," which indicates that the page must be automatically refreshed. The CONTENT
attribute specifies how long the page is displayed for before it is refreshed and also
specifies which URL to display when it is time for the page to be refreshed.
When a browser loads spot1.html, the file is displayed for three seconds. Then the
browser loads the second file, spot2.html. After three more seconds elapse, the browser
loads the file spot3.html. This code is in a file called spot1.html:

<HEAD>
<TITLE>See Spot Run</TITLE>
<META HTTP-EQUIV="refresh"
CONTENT="3;URL='http://www.homepage.com/spot2.html'">
</HEAD>

<BODY>
<IMG SRC="spot1.gif">
</BODY>
The file "spot2.html" contains the following code:

<HEAD>
<TITLE>See Spot Run</TITLE>
<META HTTP-EQUIV="refresh"
CONTENT="3;URL='http://www.homepage.com/spot3.html'">
</HEAD>
<BODY>
<IMG SRC="spot2.gif">
</BODY>
Similarly, the file "spot3.html" contains the following code:

<HEAD>
<TITLE>See Spot Run</TITLE>
<META HTTP-EQUIV="refresh"
CONTENT="3;URL='http://www.homepage.com/spot1.html'">
</HEAD>
<BODY>
<IMG SRC="spot3.gif">
</BODY>

STYLE
(style definition)
The STYLE tag specifies a style sheet. Inside <STYLE> and </STYLE> you can specify
styles for elements, define classes and IDs, and generally establish styles for use within
the document. Navigator 4.0
Communicator 4.0 supports two types of style sheets: JavaScript style sheets and
Cascading Style Sheets (CSS). To specify that the style sheet is JavaScript, the value of
the TYPE attribute is "text/javascript". The default value of TYPE is CSS.
It is beyond the scope of this reference to discuss style sheets in detail. For more
information about the STYLE tag, see the section Defining Style Sheets with the
<STYLE> Tag in Chapter 3-Creating Style Sheets and Assigning Styles in Dynamic
HTML in Netscape Communicator </docs/manuals/communicator/dynhtml/index.htm>.

Syntax
<STYLE
TYPE="stylesheetType">
...
</STYLE>

TYPE="stylesheetType"
specifies either a JavaScript style sheet or a cascading style sheet (CSS). The
value can be "text/css" for cascading style sheets, or "text/javascript" for
JavaScript style sheets.

Used Within
<HEAD> and </HEAD>.

Example 1. Cascading Style Sheet

<STYLE TYPE="text/css">
P {font-size:18pt; margin-left:20pt;}
H1 {color:blue;}
</STYLE>

Example 2. JavaScript Style Sheet

<STYLE TYPE = "text/javascript">


tags.P.fontSize = "18pt";
tags.P.marginLeft = "20pt";
tags.H1.color = "blue";
</STYLE>

LINK
(link to external files)
Use the LINK tag to link external files such as style sheets and downloadable fonts into
your document. Navigator 4.0

Syntax
<LINK
REL="fileType"
TYPE="type">
SRC="location"
...
</LINK>

REL="fileType"
specifies the kind of file to be linked. For an external style sheet, the value is
"stylesheet". For a downloadable font definition file, the value is "fontdef".

TYPE="type"
specifies more information about the particular type of file to be linked to, if that
information is needed. For style sheets, the value can be "text/css" for cascading
style sheets, or "text/javascript" for JavaScript style sheets.

SRC="location"
specifies the location of the file to be linked.

Example

<!-- link to an external style sheet -->


<LINK REL=STYLESHEET TYPE="text/css" SRC="styles/style1.htm">

<!-- link to a font definition file -->


<LINK REL=FONTDEF SRC="http://home.netscape.com/fonts/sample.pfr">

[Contents] <contents.htm> [Previous] <tags2.htm> [Next] <tags4.htm> [Alphabetical


Tag List] <alphlist.htm> [Index] <tagsix.htm>
Last Updated: 01/26/98 21:33:44

Copyright © 1998 Netscape Communications Corporation


<http://home.netscape.com/misc/contact_info.html>