HTML Page Structure

The structure of an HTML document.

The HTML stucture.

  • An HTML document can be divided in three main sections:
  • The main header section element (HEAD) and the main body section element (BODY or FRAMESET) are surrounded with the HTML element (the tag pair <html></html>).
  • There is a limitation of sub-element types a HEAD element can contain. You can find which elements in the HTML-reference.

The HTML version information.

  • A valid HTML document declares what version of HTML is used in the document. The Document Type Declaration names the document type definition (DTD) in use for the document.
  • HTML 4.01 specifies three DTDs, so you must include one of the following document type declarations in the start of your document:
    1. The HTML 4.01 Strict DTD includes all elements and attributes that have not been deprecated or do not appear in frameset documents.
      The document type declaration for this is:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
              "http://www.w3.org/TR/html4/strict.dtd">
      
    2. The HTML 4.01 Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes.
      The document type declaration for this is:
      The document type declaration for this is:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
              "http://www.w3.org/TR/html4/loose.dtd">
      
    3. The HTML 4.01 Frameset DTD includes everything in the transitional DTD plus frames as well.
      The document type declaration for this is:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
              "http://www.w3.org/TR/html4/frameset.dtd">
      
  • The browsers will go into Quirks mode if a DOCTYPE declaration (DTD) is not included.

The header section.

  • The header section defined by the HEAD element (the tag pair <head></head>) contains information about the current document, such as its title, keywords that may be useful to search engines, and other data that is not considered document content.
  • There is a limitation of sub-element types a HEAD element can contain. You can find which elements in the HTML-reference.

The body section.

  • The body section contains the document’s actual content. The body section may be implemented by the BODY element (the tag pair <body></body>) or the FRAMESET element (the tag pair <frameset></frameset>).
  • There is a limitation of sub-element types a BODY element can contain. You can find which elements in the HTML-reference.
  • There is a limitation of sub-element types a FRAMESET element can contain. You can find which elements in the HTML-reference.
    Example of a simple HTML document with a BODY element:
    <!-- We are using HTML 4.01 Strict DTD Version of HTML in this document. -->
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    
    <!-- An HTML document is contained by the HTML element. -->
    <HTML>
    
    <!-- Here comes the header section -->
      <HEAD>
    <!-- the title will appear as part of the title in the browser -->
        <TITLE>This is my first HTML document</TITLE>
      </HEAD>
    
    <!-- Here comes the body section -->
      <BODY>
        <P>Hello world!</P>
       </BODY>
    
    </HTML>

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.