<HTML>NN all IE all HTML all  

<HTML>...</HTML>

HTML End Tag: Optional  

The html element is the container of the entire document content, including the head element. Typically, the html element start tag is the second line of an HTML file, following the Document Type Definition (DTD) statement (see the DOCTYPE element earlier in this chapter). If no DTD is provided in the file (it assumes the browser's default DTD), the html start tag becomes the first line of the file. The end tag should be in the last line of the file (but it does not have to stand on its own line).

Although the html element doesn't render per se, it is the root positioning context of a document in a purely W3C-compliant environment. This applies to Netscape 6 and IE 6, the latter only when certain DOCTYPE definitions start the document. Otherwise, IE for Windows (this goes for IE 4 through IE 5.5) treats the body element as the root positioning context. If you don't specify margins, borders, or padding for the body element, you probably won't notice the difference.

The HTML 4 and XHTML standards do not include explicit support for id, class, or style attributes, but modern DHTML browsers support them.

 
Example
 
<HTML>
<HEAD>
    ...
</HEAD>
<BODY>
    ...
</BODY>
</HTML>
 
Element-Specific Attributes
 
scrollversionxmlns
 
Element-Specific Event Handler Attributes

None.

langNN 3 IE 4 HTML 4  

lang="languageCode"

Optional  

The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices.

 
Example
 
<SPAN lang="de">Deutsche Bundesbahn</SPAN>
 
Value

Case-insensitive language code.

 
Default

Browser default.

 
Object Model Reference
 
[window.]document.getElementById(elementID).lang
scrollNN n/a IE 6 HTML n/a  

scroll="featureSwitch"

Optional  

When IE 6 is in standards-compliant mode (see the DOCTYPE element earlier in this chapter), it treats the html element as the "canvas" on which it draws the document content. By default, the canvas gains scrollbars if the content overflows the content region of the window. You can force the display of scrollbars (on or off) regardless of the overflow state by setting the scroll attribute in the html element. If your pages will also be loading into older IE/Windows versions, set the same attribute in the body element the "canvas" for older versions.

 
Example
 
<HTML scroll="no">...</HTML>
 
Value

String constant: auto | no | yes.

 
Default

auto

 
Object Model Reference
 
[window.]document.getElementById(elementID).scroll
titleNN 6 IE 3 HTML 3.2  

title="advisoryText"

Optional  

An advisory description of the element. For HTML elements that produce visible content on the page, IE 4 and later and Netscape 6 render the content of the title attribute as a tooltip when the cursor rests on the element for a moment. For example, the table-related col element does not display content, so its title attribute is merely advisory. To generate tooltips in tables, assign title attributes to elements such as table, tr, th, or td.

The font and color properties of the tooltip are governed by the browser, and are not modifiable under script control. In IE/Windows, the tooltip is the standard small, light-yellow rectangle; in IE/Mac, the tooltip displays as a cartoon bubble in the manner of the Mac OS bubble help system. Netscape 6 tooltips are the same small rectangle on all OS versions. If no attribute is specified, the tooltip does not display.

You can assign any descriptive text you like to this attribute. Not everyone will see it, however, so do not put mission-critical information here. Browsers designed to meet web accessibility criteria might use this attribute's information to read information about a link or nontext elements to vision-impaired web surfers. Therefore, don't ignore this potentially helpful aid to describing an element's purpose on the page.

Although the compatibility listing for this attribute dates the attribute back to Internet Explorer 3 and HTML 3.2, it is newly ascribed to many elements starting with IE 4 and HTML 4.0.

 
Example
 
<SPAN title="United States of America">U.S.A.</SPAN>
 
Value

Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).title
versionNN 6 IE 6 HTML 3.2  

version="string"

Optional  

The version attribute is deprecated in HTML 4 and was never adopted by the major browsers until the desire to claim standards compliance led the maker to introduce the dead-end attribute. Originally intended to specify the HTML DTD version supported by the document, this information is universally supplied in the separate DTD statement (in the DOCTYPE element) above the html element in the document. Do not use this attribute.

 
Value

Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.

 
Default

None.

xmlnsNN n/a IE 5 HTML X1.0  

xmlns="namespaceSpec"

Optional  

The W3C attribute and its fixed URI value should be in the html element of every XHTML document. Microsoft uses this attribute to allow IE 5 and later for Windows to reference elements that belong to non-HTML sources, such as the Microsoft implementation of behaviors (generic external script modules that can be applied to any element).

 
Value

For XHTML, a fixed URI string: http://www.w3.org/1999/xhtml. For IE 5 and later namespace references, just a prefix name (MSIE for built-in behaviors), or a prefix and URI that acts as an additional identifier for the prefix. Note the colon delimiter.

 
Default

None.