A basic XHTML page and its structure

An XHTML document (i.e. a web page) always contains certain basic elements, inside which the web page contents are placed. Some typical features of an XHTML document are:

  • The document type has to be specified for a web page
  • The page is always framed by the html element
  • The page always contains the elements head and body inside the html element.

The following example illustrates how the above-mentioned elements are positioned on an XHTML page:


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>

<head><title>Page name</title>

<meta http-equiv=”Content-Type” content=”text/html;
charset=ISO-8859-1″ />

</head>

<body>

Page contents.

</body>

</html>

Please note the following elements also included in the example above:

 

  • title: the title of the page, which shows in the address bar of the browser. Search engines use the title element to index pages and show information.
  • meta: an element can give some meta-information and instructions on how to handle a web page. In the example above, the meta element shows which character set has been used for the web page. The example uses the character set ISO-8859-1, i.e. Latin 1, which means a western alphabet with European special characters.