XHTML Tutorial: Standards-Based Web Design

by Paul Bohman

The Document <head>

The head of a document is where you say what type of document you're creating and what language it's created in. At a minimum, an HTML document consists of a <head> and a <body>, surrounded by <html> elements. A complete document head will look something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head><title>All about parrots and cute bunny rabbits</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="parrots, bunnies, rabbits, bunny rabbits, cute" /> <meta name="description" content="Everything you ever wanted to know about parrots and bunny rabbits (especially cute ones) that you were always afraid to ask" /> </head>

Yikes! What does all that mean? Don't get too frightened. Look closely. Yeah, some of it's a mess if you don't understand it, but some of it is sort of self-explanatory. For example, lang="en" means that the language is English. The xml:lang="en" means the same thing. It's redundant, and in some ways is not necessary, but it's there for a reason. Just trust me on that one.

The "meta" elements tell us "meta" information about the page. Meta information is "information about information." Maybe that's confusing, but the concept is rather simple when you look at what the <meta> elements are doing. These particular elements are just specifying keywords for the page and giving it a brief description. Notice that <meta> elements are self-closing in the same way that <img> elements and <hr /> elements are.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.