Using <meta> Tags

The <meta> tag has a wide variety of applications, but is primarily used to include information about a document, such as the creation date, author, or copyright information. The data included in a <meta> tag is useful for servers, web browsers, and search engines but is invisible to the reader. It must always be placed within the <head> of the document.

A document may have any number of <meta> tags. There are two types of <meta> tags, using either the name or http-equiv attribute. In each case, the content attribute is necessary to provide a value (or values) for the named information or function. The examples below show basic <meta> tag syntax. In the following sections, we will look at each type of meta tag and its uses.

<META HTTP-EQUIV="name" CONTENT="content">
<META NAME="name" CONTENT="content">

The http - equiv Attribute

Information provided by an http-equiv attribute is processed as though it had come from an HTTP response header. HTTP headers contain information the server passes to the browser just before it sends the HTML document. It contains MIME type information and other values that affect the action of the browser. Therefore, the http-equiv attribute provides information that will, depending on the tag description, affect the way the browser handles your document.

There are a large number of predefined http-equiv types available. This section will look at just a few of the most useful. For a complete listing, see the Dictionary of HTML META ...

Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.