HTML 4.01 in Netscape and Explorer: Global Structure | WebReference

HTML 4.01 in Netscape and Explorer: Global Structure

nav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav button

Global Structure Spec
The Big Picture

Document Type Declarations and DTDs Spec

Both Netscape 7 and Explorer 6 use the Document Type Declarations in HTML documents to determine the version of HTML to use in formatting the document. Using the DTD will cause the browser to switch to "standards-compliant mode;" not using the DTD will switch the browser to "quirks mode," causing the browser to render the HTML in backward–compatible fashion. Your HTML and CSS code will also not validate if you fail to use the proper DTD in your documents.

There are three DTDs: Strict, Transitional, Frameset.

The Strict declaration should be used when all of the document presentation and formatting will be handled by CSS. (This may cause the page to look plain in older browsers.)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "https://www.w3.org/TR/html4/strict.dtd">

The Transitional declaration takes into account lack of support for CSS, allowing many HTML presentation features to be used as a transition towards HTML 4 Strict.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "https://www.w3.org/TR/html4/loose.dtd">

The Frameset declaration should be used for documents that use frames.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "https://www.w3.org/TR/html4/frameset.dtd">

The html element Spec

While the html element start and end tags are listed as optional in the specifications, it is a matter of good coding to use them. They can be used to specify the language used in the document, i.e. <html lang="en-US"> and also help to delineate the page. The deprecated version attribute is not supported by either browser as the information is contained in the DTD.

The head element Spec

Like the html element, the head element start and end tags are optional but should be included for proper formatting, as it is in this area that meta tags, styles, and other information is listed.

The title element Spec

The contents of the title element are shown in the window title bar by both browsers, and most character references will work fine within a title. This is an important aspect of the HTML markup as this is what is used for bookmark titles and may be used by search engines in their listings. It should be noted that only frameset titles, and not frame titles, are displayed by the two browsers.

Although the title element is required, Netscape and Explorer will display documents without a title, showing the document's URL in the title bar instead. This can cause problems and may cause the page to fail to render at all in some browsers.

The title attribute Spec

The title attribute is recognized by both Netscape and Explorer. A "tool-tip" is displayed when the mouse is passed over any element with a title attribute. Care should be taken not to abuse this method in order to create effects that should be done using other methods. The title attribute can be effectively used to give additional information about hyperlinks that don't contain a lot of information about the link destination.

Meta Data Spec

Meta Data is not processed by either Netscape or Explorer.

The body element Spec

The body element is interpreted by both browsers exactly as it appears in the specification. The use of presentational attributes (i.e., background, text, link, vlink, alink, bgcolor) should be avoided as they have been deprecated in HTML 4.01. Instead, style sheets are the preferred method.

Documents that contain framesets replace the body element with the frameset element. Consult the specification section on the frameset element for more information.

Element Identifiers Spec

Both Netscape and Explorer support the id and class attributes for their intended purpose.

Block-level and inline elements Spec

Both Netscape and Explorer will make a mess out of block-level and inline elements if they are improperly nested or formatted. You should always take care to avoid the pitfalls of improper nesting, and only use inline and block-level elements according to the specification.

Grouping Elements Spec

The div and span elements are recognized and supported by both Netscape and Explorer according to the specification.

Headings Spec

Headings are rendered identically by Netscape and Explorer, though both will allow block-level elements inside them, which is normally forbidden. There is no reason to include block-level elements inside headings, since the formatting you might be trying to achieve can be accomplished by other methods that are in accordance with the specification. Headings have the annoying tendency of sticking to their default rendering even when you supply them with style information, due to the buggy support of CSS by both browsers, but it is important to remember that headings are, above all, a logical construct, and identify topic headings, not just large, bold text. You should use heading elements to denote headings, and use CSS for formatting, not the other way around.

The address element Spec

The address element is rendered as italic text by both browsers, and is functionally equivalent to a block-level i element. Note that although both browsers allow block-level elements inside an address element, this is normally forbidden.

nav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav buttonnav button

https://www.internet.com


All Rights Reserved. Legal Notices.
Created: Mar. 12, 1998
Revised: November 15, 2004