Next / Previous / Contents / TCC Help System / NM Tech homepage

8. Overall structure of an XHTML file

In order to be a valid XHTML page, your file must have at least this structure:

sample.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>T</title>
    H
  </head>
  <body>
    B
  </body>
</html>

That is, the root html element must have two child elements named head and body.

The head element's first child element must be a title element with some title content T. You can add other optional elements to describe the page's overall characteristics at position H.

Inside the body element you will place the actual content of your page. This may include text paragraphs, figures, tables, forms, and many other types of content.

The following sections describe the exact syntax of these elements and some others you will use to give overall structure to the page.

8.1. The root element: html

This element must be the root (outermost) element of any valid XHTML page. Content model:

element html
{ attribute xml:lang { text }?,
  attribute xmlns { xsd:anyURI }?,
  head,
  body
}
xml:lang

Defines the language of the document. See Section 15.1, “The xml:lang attribute”.

xmlns="http://www.w3.org/1999/xhtml"

Defines this document as XHTML 1.1.

head

Document header element. See Section 8.2, “The head element: Overall page information”.

body

Document body. See Section 8.9, “The body element”.