|
||
|
Document StructureOur first stop is a brief discussion on document structure. Most HTML authors recognize their document's contain a HEAD section and a BODY section, where the HEAD is information about the page, and the BODY contains the contents. However, many authors fail to include a third required component in their HTML document, the document type. Looking at most web pages (and admittedly, the pages on this site), you will notice that the document type is missing. HTML 4.0 defines three different types of documents. Each of these document types refer to a DTD (document type definition) that defines the rules for a proper HTML document. Below lists the different document types as listed in the HTML 4.0 recommendation.
In summary, remember all HTML 4.0 documents consist of the following three sections:
HTML Structure is ImportantAll HTML elements within a document should be properly contained and create a hierarchical tree. This means that HTML elements must
be contained within other elements, and should never overlap. For example, the following is very common on the web but is actually not valid HTML:
The problem with the above HTML is that the B and the I element overlap and are not properly contained. Overlapping can usually be easily fixed:
We have rewritten the invalid overlapping to be proper HTML. This proper HTML more reliably produces the results expected by the original HTML. Since the first example with overlapping HTML is not valid, there are no assurances that a complaint browser will accept it. Overlapping and using improper HTML causes greater problems when combined with style sheets and scripting, since both of these use the structure and containment of elements to determine behavior and appearance. Next we explore the <HEAD> element and what information can be specified about your document. |
Copyright © 1997-2008 InsideDHTML.com, LLC. All rights reserved.