HTML The Definitive Guide (80 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
5.84Mb size Format: txt, pdf, ePub

document. In this case, the browser might use the title when displaying the referenced document. For example:

title="A photograph of the Noble Fruit"> tells the browser to use the indicated title when displaying the referenced image.

The value of the attribute is an arbitrary character string, enclosed in quotation marks.

7.7.2.4 The type attribute

The type attribute provides the MIME content type of the linked document. Supported by both Internet Explorer and Netscape, the HTML 4.0 standard type attribute can be used with any linked document. It is often used to define the type of linked style sheets. In this context, the value of the type attribute is usually text/css. For example: creates a link to an external style sheet within the of a document. See
Chapter 9, Cascading

Style Sheets
for details.

7.7.2.5 How browsers might use
Although the HTML standard does not require browsers to do anything with the information provided by the tag, it's not hard to envision how this information might be used to enhance the presentation of a document.

As a simple example, suppose you consistently provide tags for each of your documents that define next, prev, and parent links. A browser could use this information to place a standard toolbar at the top or bottom of each document containing buttons that would jump to the appropriate related document. By relegating the task of providing simple navigational links to the browser, you are free to concentrate on the more important content of your document.

As a more complex example, suppose a browser expects to find a tag defining a glossary for the current document, and that this glossary document is itself a searchable document. Whenever a reader clicked on a word or phrase in the document, the browser could automatically search the glossary for the definition of the selected phrase, presenting the result in a small pop-up window.

As the Web and HTML evolve, expect to see more and more uses of the tag to define document relationships explicitly on the Web.

7.7.2.6 Other attributes

The HTML 4.0 standard also includes the ubiquitous collection of attributes related to style sheets and user events, and language for the tag. You can refer to the corresponding section describing these attributes for the
tag for a complete description of their usage. [The Tag, 7.3.1]

Since you put the tag in the section, whose contents do not get displayed, it may seem that these attributes are useless. In fact, it is entirely possible that some future browser may find some way to display the information to the user, possibly as a navigation bar or a set of hotlist selections. In those cases, the display and rendering information would prove useful.

Currently, no browser provides these capabilities.

7.6 Creating Searchable

7.8 Supporting Document

Documents

Automation

Chapter 7

Links and Webs

 

7.8 Supporting Document Automation

There are two additional header tags whose primary function is to support document automation, interacting with the Web server itself and document-generation tools.

7.8.1 The Header Element

Given the rich set of HTML header tags for defining a document and its relationship with others that go unused by most HTML authors, you'd think we'd all be satisfied.


Function:

Supply additional information about a document Attributes:

CHARSET

LANG

CONTENT NAME

DIR SCHEME

HTTP_EQUIV

End tag:

None

Contains:

Nothing

Used in:

head_content

But no. There's always someone with special needs. They want to be able to give even more information about their precious document, information that might be used by browsers, readers of the HTML source, or by document-indexing tools. The tag is for you who need to go beyond the beyond.

The tag belongs in the document header and has no content. Instead, attributes of the tag define name/value pairs that associate the document. In certain cases, these values are used by the web server serving the document to further define the document content type to the browser.

7.8.1.1 The name attribute

The name attribute supplies the name of the name/value pair defined by the tag. The HTML

standard does not define any predefined names. In general, you are free to use any name that makes sense to you and other readers of your HTML source.

One common name used is keywords, which defines a set of keywords for the document. When encountered by any of the popular search engines on the Web, these keywords will be used to categorize the document. If you want your documents to be indexed by a search engine, consider putting this kind of tag in the of each document: If the name attribute is not provided, the name of the name/value pair is taken from the http-equiv attribute.

7.8.1.2 The content attribute

The content attribute provides the value of the name/value pair. It can be any valid string, enclosed in quotes, if it contains spaces. It should always be specified in conjunction with either a name or http-equiv attribute.

As an example, you might place the author's name in a document with:
7.8.1.3 The http-equiv attribute

The http-equiv attribute supplies a name for the name/value pair and instructs the server to include the name/value pair in the MIME document header that is passed to the browser before sending the actual document.

When a server sends a document to a browser, it first sends a number of name/value pairs. While some servers might send a number of these pairs, all servers send at least one: content-type: text/html

This tells the browser to expect to receive an HTML document.

When you use the tag with the http-equiv attribute, the server will add your name/value pairs to the content header it sends to the browser. For example, adding: causes the header sent to the browser to contain: content-type: text/html

Other books

Amazing Love by Mae Nunn
Drink by Iain Gately
True Crime by Andrew Klavan
Your Republic Is Calling You by Young-Ha Kim, Chi-Young Kim
Kelly by Clarence L. Johnson
Blistered Kind Of Love by Angela Ballard, Duffy Ballard