|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
The HTML element declares the enclosed text to be an HTML document. In a standard document, HTML can directly contain only two elements: HEAD and BODY, while in a frame-document, HTML can directly contain the elements HEAD, FRAMESET, and NOFRAMES, but cannot directly contain a BODY. The optional LANG and DIR attributes specify the language used in the document, as well as the direction in which the text should be laid out on the display. The optional VERSION attribute takes as its value a URL that points to the DTD, which encodes the HTML version corresponding to the document. This attribute is not currently supported, and indeed is deprecated, since the DOCTYPE declaration (discussed earlier) contains exactly the same information. Two simple examples illustrating the use of HTML are: <HTML> <HEAD> ... head content.... </HEAD> <BODY> ... body content.... </BODY> </HTML> <HTML> <HEAD> ... head content.... </HEAD> <FRAMESET> ... frame document content </FRAMESET> <NOFRAMES> ... noframe content </NOFRAMES> </HTML> Frame documents and the FRAMESET, FRAME, and NOFRAMES elements are discussed in Chapter 7. HEAD Element: Document Meta-information
HEAD contains general information about the document. This information is not displayed as part of the document text; consequently, only certain elements are appropriate within the HEAD. These elements (BASE, ISINDEX, LINK, META, SCRIPT, STYLE, and TITLE) can appear inside HEAD in any order. The only mandatory HEAD element is TITLE; all others are optional. All the head elements except TITLE, SCRIPT, and STYLE are empty. The optional PROFILE attribute takes as its value a URL (or multiple space-separated URLs) pointing to a document containing metadata describing the document or the document collection. However, the format for such metadata documents is still being developed, so that this attribute is not in current use. The division between the HEAD and the BODY is important, as there are mechanisms for retrieving just the information in the document HEAD. Since the HEAD is always much smaller than the body, this is faster than accessing an entire document and can be extremely useful for generating fast catalogs or indexes. BODY Element: The Document Text Body
The BODY contains the document proper, as opposed to the meta-information found in the HEAD. Formally, the BODY should not directly contain text; instead, it should contain elements that in turn contain the text. Recall that BODY states simply this is the body of the document and supplies no additional meaning to its content. It is the job of elements nested within the BODY to organize the text and assign it meaning. This is accomplished by the elements that define headings, lists, addresses, paragraphs, and so on. The contents of the HEAD and BODY are largely exclusiveelements that belong inside the HEAD do not belong inside the BODY, and vice versa. BODY can take the optional default attributes such as CLASS and DIR, as well as the listed event-handling attributes (onClick, etc.): These attributes were described previously in the sections entitled Important Generic Attributes and Event-Handler Element Attributes. HTML 4 supports several other attributes for specifying properties of the document body, such as the default text colors and page background properties. Some proprietary attributes are supported by Microsoft Internet Explorer. In general, these properties are better (and much more easily) specified by style sheets, as described in Chapter 7. Indeed, these attributes will likely be dropped in a future version of HTML, in favor of the style sheet approach.
HEAD Meta-information ElementsThere are only seven elements that can appear in the document HEAD. These elements (and their associated meanings/content) are shown in Table 6.8. All these elements are empty, except for TITLE, SCRIPT, and STYLE. As you can tell by the descriptions, these elements provide information about the document, such as the title, the relationship to other documents, or a style sheet that should be applied to the document. To support older, less well-designed documents and software, the DTD actually allows ISINDEX and STYLE elements within the BODY. However, you are best advised to keep them within the head, where they belong. BASE Element: Base URL
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |