This chapter provides a complete list of HTML tags and attributes implemented in Microsoft Internet Explorer and Netscape Navigator, as well as the ones specified in the W3C recommendations for HTML 4.01 and XHTML 1.1. Version information accompanies each tag and attribute so that you can see whether a particular entry applies to the browser(s) you must support. At a glance, you can see the version number of Internet Explorer, Netscape Navigator, and the W3C HTML specification in which the item was first introduced. Because this book deals with Dynamic HTML, the history timeline goes back only to HTML 3.2, Navigator 2, and Internet Explorer 3.
If an item existed prior to one of these versions and is still in use, it is simply marked "all." Where no implementation exists, I've used "n/a" to indicate that. In rare instances, an item has been removed from the HTML specification or a browser family. Such items are marked with a less-than symbol and the version number that no longer supports the item (e.g., NN <6 for prior to Netscape 6). Items valid for a single version show the number encased in pipe symbols (e.g., |4| for Version 4 only). Deprecated items are listed here because modern browsers support them for backward compatibility, and legacy code may rely on them. Text references to Netscape 6 automatically imply support for all Mozilla-based browsers, including Netscape 7.
A handful of items that appear as new for Version 6 browsers may not, in truth, be fully implemented in these browsers. This occurs when a browser maker claims support for an element or attribute because the item is implemented in HTML 4, and the browser wishes to claim compliance with that standard version. The descriptions of such items clearly state when the item is valid but not connected.
Following a section that lists attributes shared by all elements, this chapter is organized alphabetically by HTML element (or tag, if you prefer); within each element's description, attributes are listed alphabetically and displayed in a grey font. The reference entries are designed so that it is easy to see which elements require end tags (in HTML), and whether attributes are optional or required. Scripted object references are displayed in the W3C DOM standard syntax style unless the item requires a different DOM style (e.g., the Navigator 4 layer element). Although the W3C DOM document.getElementById( ) syntax prevails in the listings, if IE supports the item through its DOM scripting, you can assume that the document.all reference style also applies in that environment. The description for an item details any significant differences between the various browser implementations of the item.
All example code is formatted according to W3C HTML standards because the widest number of DHTML browsers support that format and all readers will be familiar with it. At the same time, however, the code demonstrates most practices encouraged for XHTML formatting, such as lowercase tag and attribute names and quoted attribute values of all types. The only XHTML formatting characteristics lacking from the example code are end tags for empty elements (such as the XHTML backward-compatible <br /> technique) and explicit value assignments to attributes that do not require them in HTML (such as the selected attribute of checkbox type input elements). These coding style variations are easy to modify on your own if your code must conform to XHTML validation (see Chapter 1).
For in-depth coverage of event types related to event attributes mentioned in this chapter, see Chapter 10. To find out which, if any, HTML and XHTML DTDs support a particular element or attribute, consult Appendix E.
Many HTML element attributes share similar data requirements. For the sake of brevity in the reference listings, this section describes a few common attribute value types in more detail than is possible within each listing. Whenever you see one of these attribute value types associated with an attribute, consult this section for a description of the type.
A length value defines a linear measure of document real estate, such as the width of a table element. The unit of measurement can be any applicable unit that helps identify a position or space on the screen. HTML attribute length units are uniformly pixels, but in other content, such as that specified in Cascading Style Sheets (see Chapter 11), measurements can be in inches, picas, ems, or other relevant units. A single numeric value may represent a length when it defines the offset from an edge of an element. For example, a coordinate point (10,20) consists of two length values, denoting pixel measurements from the left and top edges of an element, respectively. Attributes associated with length values are deprecated in favor of corresponding CSS attributes for strict HTML 4 and XHTML conformance.
An identifier (usually assigned to name or id attributes) is a name that adheres to some strict syntactical rules. Most importantly, an identifier is one word with no whitespace allowed. If you need to use multiple words to describe an item, you can use the inter-capitalized format (in which internal letters are capitalized) or an underscore character between the words. Most punctuation symbols are not permitted, but all numerals and alphabetical characters are. To avoid potential conflicts with scripting languages that refer to items by their identifiers, it is good practice to avoid using a numeral for the first character of an identifier.
There is an extensive list of standard codes that identify the spoken and written languages of the world. A language code always contains a primary language code, such as "en" for English or "zh" for Chinese. Common two-letter primary codes are cataloged in ISO-639 (an excerpted list of codes is available at http://www.ietf.org/rfc/rfc1766.txt). An optional subcode (separated from the primary code by a hyphen) may be used to identify a specific implementation of the primary language, usually according to usage within a specific country. Therefore, although "en" means English, "en-US" means a U.S.-specific version of English. The browser must support a particular language code for its meaning to be of any value to an element attribute.
The frequent presence of the align attribute among various elements (and the related but less pervasive valign attribute) is misleading when describing attribute values, because the attribute conveys different meanings for several element groups. Add to the mix several proprietary values that are implemented in some browsers, and it's easy to confuse which values to use when. That all such attributes are deprecated in favor of the CSS text-align (horizontal) and vertical-align attributes is welcome relief to authors who develop for browsers that support CSS.
Element alignment is divisible into five categories, each with its own set of applicable elements and permissible values. Browsers accept case-insensitive values, but if you intend to continue working with these attributes, you should get in the habit of using all lowercase values to conform with the transitional DTDs.
The first category governs the alignment of text that surrounds the rectangular space of the element bearing the align attribute. W3C HTML elements in this category include applet, iframe, img, input, and object. IE adds embed, fieldset, and select elements to the list, while deleting iframe. Here is a synopsis of the various align attribute settings for these elements and how they affect the display of the element and surrounding text content:
The legend element acts like a label for a form's fieldset element. The caption does the same for a table. Alignment of these elements applies to the location of the element's text relative to the rectangular space occupied by the form's fieldset border or table. The align attribute settings for this category are:
This category is potentially confusing because of the perception of what a browser does when you set the align attribute for the p, div, h1 through h6, and hr elements. These block elements normally occupy a transparent box that is the full width of the next outermost container. For most elements, that container is the body element, which extends to nearly the full width of the browser window. Therefore, when you specify one of the three primary W3C-sanctioned attribute values to an element containing short strings—center, left, and right—it appears as though the element, itself, is being aligned. In truth, the element is in the exact same spot, taking up the same width as other body content, but the text inside is aligned per the attribute setting. If you specify a fixed-width style for the element, the align attribute continues to control the text inside the element, while the element hugs the left margin. To center the width-constrained element, you must nest it inside another full-width container, and set its align attribute to center.
To add to the confusion, the W3C HTML 4 transitional specification allows for a value of justify, while the strict HTML 4 and all XHTML specifications remove that value from text alignment types of align attributes (except for table element components). Browsers support the justify value when aligning these elements.
In the W3C specification, text inside descendant nodes of the table element (tbody, tr, td, and the rest) can be aligned according to the values center, justify, left, and right. IE, however, does not recognize the justify value for table components. If you wish to justify text in an IE table cell, wrap the text in a p or div container, and set that container's align attribute to justify.
A color value can be assigned either via a hexadecimal triplet or with a plain-language equivalent. A hexadecimal triplet consists of three pairs of hexadecimal (base 16) numbers that range between the values 00 and FF, corresponding to the red, green, and blue components of the color. The three pairs of numbers are bunched together and preceded by a pound sign (#). Therefore, the reddest of reds has all red (FF) and none (00) of the other two colors: #FF0000; pure blue is #0000FF. The letters A through F can also be lowercase.
This numbering scheme creates a huge number of potential combinations (over 16 million), but not all video monitors are set to distinguish among millions of colors. Therefore, you may wish to limit yourself to the more modest palette of colors known as the web palette. A fine reference of colors that work well on all browsers at popular bit-depth settings can be found at http://www.lynda.com/hexh.html.
The HTML recommendation also specifies a basic library of 16 colors that can be assigned by plain-language names. Note that the color names are case-insensitive. The names and their equivalent hexadecimal triplets are as follows:
In other words, the attribute settings bgcolor="Aqua" and bgcolor="#00FFFF" yield the same results.
Netscape developed a much longer list of plain-language color equivalents. These are detailed in Appendix A, and are recognized by recent versions of both Navigator and Internet Explorer.
Copyright © 2003 O'Reilly & Associates. All rights reserved.