HTML/Training/HTML Document

From W3C Wiki
< HTML‎ | Training
Revision as of 22:34, 21 July 2011 by Plehegar (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">
<head>

  Document metadata

</head>
<body>

  Document contents

</body>
</html>

Description

doctype

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>

     or

<!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">

</html>


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.
<head>

</head>

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.
<body>
  <p>Here is the visible content</p>
</body>

See also The body element


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