HTML 4.01 in Netscape and Explorer: SGML and HTML | WebReference

HTML 4.01 in Netscape and Explorer: SGML and HTML

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

SGML and HTML Spec
Remembering your heritage

Elements Spec

It's good practice to include both the start and end tags of all of your elements, especially if you're going to be using scripting or stylesheets, since the object model of the two browsers will usually not include elements whose tags have been omitted.

Both browsers will usually take any element literally and not worry about its content or its parent element. A good example is lists that contain character data instead of list items. These methods have often been used to achieve formatting effects such as indenting text, but with the advent of stylesheets and the partial support of CSS1 by both Netscape and Explorer this has become useless. I recommend that you avoid these methods and stick to the specification, only using elements for their intended purpose. There is no longer any reason to abuse the leniency or inconsistencies in the browser's implementations to achieve effects that can be achieved according to the specification.

Attributes Spec

Values in attributes can usually be unquoted in both browsers and still fulfill their intended purpose, but this is not recommended since other browsers will often get confused. It can also lead to problems when using JavaScript.

Character References Spec

Both Netscape and Explorer can display all of the HTML 4.01 character entity references, in addition to numeric character references and hexadecimal character references.

Both will usually render character references even if the ending semi-colon is omitted. This, however, is a bad practice and doesn't always work. You should make sure your character references are properly terminated.

Netscape and Explorer will directly render character references they don't identify, i.e. they will display the ampersand, reference, and semi-colon.

Comments Spec

Comments act strange within Netscape and Explorer when you don't use them correctly. If a comment is started with (<!--) and the end of it (-->) cannot be found, it will be ended at the first tag end delimiter (>). This can be very frustrating when you're trying to comment out parts of your document that contain tags. Contrary to what the specification states, Netscape and Explorer do not accept whitespace after the end of the comment (the two dashes) and the tag end delimiter. Also contrary to the specification, they do not complain about strings of two or more dashes within a comment.

Generally speaking, it is useful to ignore the SGML semantics of comments and treat them as something like an element with a special start tag that is exactly <!-- and an end tag that is exactly -->. If you want to adhere to the spec, you should make sure there are no consecutive dashes between these tags.

SGML Constructs

Keeping with their unknown tag tolerance policy, the two browsers will ignore any SGML construct within a document as an unknown tag. Care should be taken not to end this perceived tag prematurely by including a tag end delimiter (>) within the construct.

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

http://www.internet.com


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