<META>NN all IE all HTML all  

<META>

HTML End Tag: Forbidden  

A meta element conveys hidden information about the document. Some browsers respond to this element to derive header information that may be important to the document but is not sent by the server in response to the request for the document. The element is also used to embed document information that some search engines use for indexing and categorizing documents on the World Wide Web.

More than one meta element may be included in a document, and all meta elements belong nested inside the head element. The specific purpose of each meta element is defined by its attributes. Typically, a meta element reduces to a name/value pair that is of use to either the server or the client. For example, most browsers recognize attribute settings that force the page to reload (or redirect to another page) after a timed delay. This would be useful in a page whose content is updated minute-by-minute, because the browser keeps reloading the latest page as often as indicated in the meta element.

Several other elements and attributes in HTML 4 contain the same kind of metadata that might otherwise be located in meta elements. Use the avenue that is best suited to your intended server and browser environments. See also the address, del, ins, link, and title elements, as well as the profile attribute of the head element.

Much mythology surrounds meta element usage. Some attribute values affect only some browsers (controlling the browser cache, for example), and not all search engine bots respond to meta tag attribute values the same way (if at all). At the same time, commonly-used powers, such as refresh, are frowned upon by the standards. There are no mandated standards for acceptable values, but the W3C validators for HTML 4 and XHTML point toward acceptance of the character set value shown in the example below.

 
Example
 
<HEAD profile="http://www.giantco.com/profiles/common">
    <META name="Author" content="Jane Smith">
    <META name="keywords" content="benefits,insurance,plan">
    <META http-equiv="refresh"
    content="1;URL=http://www.giantco.com/truindex.html">
    <META http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-5">
</HEAD>
 
Element-Specific Attributes
 
contenthttp-equivnamescheme
 
Element-Specific Event Handler Attributes

None.

contentNN all IE all HTML all  

content="valueString"

Required  

The equivalent of the value of a name/value pair. The attribute is usually accompanied by either a name or http-equiv attribute, either of which act as the name portion of the name/value pair. Specific values of the content attribute vary with the value of the name or http-equiv attribute. Sometimes, the content attribute value contains multiple values. In such cases, the values are delimited by commas, semicolons, or whatever delimiter the browser expects for that content. Some of these values may be name/value pairs in their own right, such as the content for a refresh meta element. The first value is a number representing the number of seconds delay before loading another document; the second value indicates a URL of the document to load after the delay expires.

 
Example
 
<META http-equiv="refresh"
content="2;URL=http://www.giantco.com/basicindex.html">
 
Value

Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).content
http-equivNN all IE all HTML all  

http-equiv="identifier"

Optional  

When a server sends a document to the client with the HTTP protocol, a number of HTTP header fields are sent along, primarily as directives to the client about the content on its way. meta elements can add to those HTTP headers when the http-equiv attribute is assigned to a document. Browsers convert the http-equiv and content attribute values into the HTTP response header format of "name: value" and treat them as if they came directly from the server.

Web standards define a long list of HTTP headers (see Webmaster in a Nutshell by Stephen Spainhour and Valerie Quercia, published by O'Reilly & Associates), but some of the more common values are shown in the following examples. Not all browsers respond to all header types, and some browsers respond to browser-specific headers (e.g., the IE 6 MSTHEMECOMPATIBLE header). You can have either the http-equiv or name attribute in a meta element, but not both.

 
Example
 
<META http-equiv="refresh"
content="1,http://www.giantco.com/truindex.html">
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
<META http-equiv="expires" content="Sun, 15 Jan 1998 17:38:00 GMT">
 
Value

Any string identifier.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).httpEquiv
langNN 3 IE 4 HTML 4  

lang="languageCode"

Optional  

The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices.

 
Example
 
<SPAN lang="de">Deutsche Bundesbahn</SPAN>
 
Value

Case-insensitive language code.

 
Default

Browser default.

 
Object Model Reference
 
[window.]document.getElementById(elementID).lang
nameNN all IE all HTML all  

name="identifier"

Optional  

An identifier for the name/value pair that constitutes the meta element. Typically, the attribute value is a plain-language term that denotes the purpose of the meta element, such as "author" or "keywords". You can assign a value to either the name or http-equiv attribute, but not both, in the same meta element.

 
Example
 
<META name="Author" content="Jane Smith">
<META name="keywords" content="benefits,insurance,plan">
 
Value

Any string identifier.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).name
schemeNN 6 IE 6 HTML 4  

scheme="identifier"

Optional  

Provides one more organizational layer to metadata supplied with a document. For example, a university campus with several libraries might generate documents associated with each of the libraries. Assuming that a browser is equipped to interpret metadata about this, one approach at assembling the tags is to create a separate name attribute value for each library: name="law", name="main", name="engineering", and so on. But it may also be necessary to associate these name values with a specific university. The scheme attribute could be called into service to align the metadata with a particular university: scheme="Harvard". Now, other university library systems could use the same organization of name attributes, but the scheme attribute clearly associates a given meta element with a specific university and library. Again, this assumes that the browser is empowered to do something special with this metaknowledge.

 
Example
 
<META scheme="Chicago" name="classicalFM" content="98.7">
 
Value

Any string identifier.

 
Default

None.

 
Object Model Reference
 
[window.]document.getElementById(elementID).scheme