Screen Printing

TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)

XHTML vs HTML

Page 3 of 6


The <html> section

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

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
   <title>Title of the document</title>
</head>

<body>
   Contents of the document
</body>

</html>
Both, the
<head>
and the
<body>
sections must be nested inside the
<html>
section.

The
<html>
opening tag must include the mandatory xmlns attribute with the http://www.w3.org/1999/xhtml value (again, refering to the XHML standard).

The
<html>
opening tag can also include the optional lang attribute to define the language you will use for the contents of your web page. The language value must be a two-letter code.
   eg.     en = English     fr = French     es = Spanish

For the complete list of language codes, please refer to http://xml.coverpages.org/iso639a.html.

Remember, although the lang attribute is optional, its proper use will greatly help search engines to index your site correctly.

More pages of this tutorial → XHTML vs HTML  <123456>

Comments & Questions