Meta Tags

Before you start looking at how to test your site, you need to learn about one tag: the < meta > tag. Meta tags live in the < head > of a document and contain information about a document. They live in the < head > rather than in the < body > of the document because the < body > is reserved for actual content, while the < meta > tag is used to give information about what is in the body of the document.

The information can be used for a number of purposes including helping search engines index your site, specifying the author of a document, and, if the document is time-sensitive, specifying when the page should expire.

The < meta > element is an empty element and so does not have a closing tag; rather, < meta > elements carry information within attributes, so you need a forward slash character at the end of the element.

For example, here is a < meta > element that provides a description of a computer bookshop web site:

< meta name=”description” content=”Buy computer programming books to learn HTML, XHTML, JavaScript, ASP.Net, PHP, Ruby” />

The < meta > element can take eight attributes, four of which are universal attributes — dir, lang, xml:lang, and title. The other four, however, are specific to the < meta > element:

- schema

- name

- content

- http-equiv

The name and content attributes tend to be used together as do the http-equiv and content attributes. These pairings will be addressed next.