Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


HTML Element Specifications

This section describes each HTML element, complete with a description of the purpose of the element, a list of where the element can be used, and examples of its use. This section describes elements from the HTML 4 specification, although a few non-HTML 4 elements and attribute extensions are mentioned where appropriate. Some HTML 4 elements, namely the frame-related elements (FRAME, FRAMESET, IFRAME, and NOFRAMES), OBJECT, and the advanced form input elements (BUTTON, FIELDSET, LABEL, LEGEND and OPTGROUP), are discussed in Chapter 7. Chapter 7 also covers the remaining, commonly supported, non-HTML 4 elements.

Key to Element Specifications: Content Rules and Allowed Attributes

Because HTML is a hierarchical language, is it important to know not only how to use an element, but also where it can be used. This information is given in the four lines at the beginning of each element’s description. The format is:

Usage: <NAME> ... </NAME>
Can Contain: element list
Can Be Inside: element list
Attributes: attribute list

where element list is a list of allowed elements and attribute list is a list of allowed attributes. Figure 6.4 shows an example, using the TD table data element where the four fields in Figure 6.4 define the rules for using the different elements. A detailed description of the fields is found in Table 6.2.


Special Case: INS and DEL Elements

The new HTML 4 elements INS and DEL denote inserted and deleted content. These elements can appear anywhere inside the BODY, including anywhere within any nonempty element lying inside the BODY, with the exception of SCRIPT and TEXTAREA.

Because INS and DEL do not define document structure, it is confusing to discuss them in the same context as the structure-related elements. Thus, in this chapter and Chapter 7, INS and DEL are not explicitly mentioned in the content-rules given at the beginning of each element’s description. For details regarding the correct use of INS and DEL, please see the sections at the end of this chapter describing these two elements.



Table 6.2 Meanings of Fields in Element Definitions (see also Figure 6.4)
Usage: Shows how the element is used. An end tag indicates that an element is a container (the Can Contain field lists what can go inside the element). If the end tag is enclosed by parentheses, then it is optional. If no end tag is given, then the element is empty.
Can Contain: Indicates what elements can go inside this element. This is given as two lists: a list of block elements (if any are allowed), followed by a list of inline elements. In the latter category, the string “characters” indicates elements that can contain text. If the element is empty and takes no content, the word “empty” appears here. In several places, the ISINDEX name appears enclosed by square brackets. This indicates that the element is allowed, but that it should more appropriately appear in the HEAD. Elements that are proposed as part of the HTML standardization process are shown in boldface italics. Underlined elements are proprietary extensions by browser vendors.
Can Be Inside: Indicates the elements inside which this element can be placed. This is given as two lists: a list of block elements (if any are allowed as content), followed by a list of inline elements. The example in Figure 6.4 indicates that the TR element can be inside TABLE, TBODY, TFOOT, or THEAD elements, but nowhere else.
Attributes: This lists the names of the attributes that can be taken by the element. The word “none” means that the element takes no attributes. Attributes proposed as part the HTML standardization process are shown in bold face italics. Underlined attributes are proprietary extensions by browser vendors.

Element and Attribute Notation

Element and attribute names are shown in capitalized boldface. Elements that are new as of HTML 4 are shown in italics, while underlined elements are proprietary to certain browsers vendors. Element names with a line struck through them are deprecated—these elements will probably be dropped in a future version of HTML and should consequently be avoided in new documents where possible. The following table summarizes this notation, with examples:


INPUT Standard element or attribute; widely supported.
OBJECT New element or attribute, added to standard as of HTML 4. Such elements or attributes are not universally supported.
STRIKE Deprecated element or attribute; avoid this element in new documents.
BORDERCOLOR Proprietary element or attribute; only supported on specific browsers.

Special Element and Attribute Abbreviations

For ease in reading, several abbreviations representing groups of elements or groups of attributes are used in the element descriptions. These abbreviations are defined in Table 6.3 and illustrated in Figure 6.4.

Attribute Value Notation and Definitions

Attribute values are either arbitrary strings selected by the user, such as URLs in hypertext anchors, form variable names and values, and so on (generally literal strings); or particular values (generally, but not always, name tokens) defined as part of HTML. To distinguish between these two types, user-definable values are presented in quoted italics (“value”), while values defined as part of HTML are presented as quoted regular text (“value”). The notation is summarized in Table 6.4.

In addition, user-defined values are often restricted in some way; for example, color specifications must be given as RGB color codes or as special named colors, while lengths may need to be integer numbers, and so on. Notation used with attribute value assignments to indicate these requirements is outlined in Table 6.5.


Table 6.3 Key to Abbreviations Used in Element Descriptions
Hn The six heading elements H1, H2, H3, H4, H5, and H6.
characters Any valid printable character, character reference, or entity reference.
character highlighting ABBR, ACRONYM, BDO, CITE, CODE, DFN, EM, KBD, Q, SAMP, SPAN, STRIKE, STRONG, VAR; and B, BIG, FONT, I, S, SMALL, SUB, SUP, TT, U
These are the logical (ABBR through VAR) and physical (B through U) text/phrase markup elements that mark text for meaning or special formatting. Note that STRIKE, FONT, S, and U are deprecated elements, likely to be dropped in a future version of HTML.
Standard event handlers onClick, onDblClick, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
These are the “event” handler attributes supported by most HTML elements. See also Table 6.7 and Chapter 7.


Figure 6.4  Explanation of notation used to describe elements.


Table 6.4 Explanation of Attribute Value Assignments
ATTRIBUTE=“value” Nonitalicized strings indicate attribute values that are defined as part of HTML and that are not arbitrary: for example, ALIGN=“center”, or METHOD=“post”.
ATTRIBUTE=“valueItalicized strings indicate arbitrary user-defined values. The value may be limited by context; for example, in BGCOLOR=“#rrggbb”, the string references an RGB color code, which restricts the allowed value of the string rrggbb. The special meanings of these strings are described in Table 6.5.


Previous Table of Contents Next


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.