HTML/Training/HTML Document

From Web Education Community Group
< HTML‎ | Training
Revision as of 14:10, 18 November 2011 by Rworth (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

HTML Document

The following example is basic HTML document:

<!doctype html>
<html lang="en">

  Document metadata


  Document contents




The DOCTYPE must be specified, and be top in the HTML document. That is, the DOCTYPE exists before the <html> start tag.
The DOCTYPE declaration is <!DOCTYPE html> and is case-insensitive in the HTML syntax.

<!DOCTYPE html>


<!doctype html>

See also 2.2 doctype(HTML5 differences from HTML4).

html element

The html element represents the root of an HTML document.

  • The html element should always have a lang attribute. The lang attribute Specifies the primary language for the contents of the element. For example, "en" means "English", "fr" means "French". There are tools available which provide additional help while searching the langage tag, such as Richard Ishida's Language Subtag Lookup tool.
  • The <html> ... </html> contains a head element followed by a body element.
<html lang="en">


See also:

head element

The head element represents a collection of metadata for the Document.

  • The <head> ... </head> contains the title, and information on style sheets and scripts.
  • Contents in the head tag are not displayed on a Web browser.


See also The head element

body element

The body element represents the main content of the document.

  • The <body> ... </body> contains the markup with the visible content.
  <p>Here is the visible content</p>

See also The body element

These tag composes the base of HTML document.
The next chapter introduction the "document metadata".