HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<meta> (Meta-Information)


This element specifies general information about a document that can be used in document indexing. It also allows a document to simulate HTTP response headers which are useful for cache control, page ratings, page refresh time, and other useful things.

Standard Syntax


<meta
content="string"
dir="ltr | rtl"
http-equiv="http header string"
id="unique alphanumeric string"
lang="language code"
name="name of meta-information"
scheme="scheme type" />

Events Defined by Internet Explorer


onlayoutcomplete

Element Specific Attributes


content
This attribute contains the actual meta-information. The form of the meta-information varies greatly, depending on the value set for name.

http-equiv
This attribute binds the meta-information in the content attribute to an HTTP response header. If this attribute is present, the name attribute should not be used.

lang
This attribute is the language code associated with the language used in the content attribute.

name
This attribute associates a name with the meta-information contained in the content attribute. If present, the http-equiv attribute should not be used.

scheme
The scheme attribute is used to indicate the expected format of the value of the content attribute. The particular scheme also can be used in conjunction with the metadata profile, as indicated by the profile attribute for the head element.

Examples


<!-- Use of the meta element to assist document indexing -->
<meta name="keywords" content="html, scripting"
scheme="Lycos">


<!-- Use of the meta element to implement client-pull to automatically
load a page -->
<meta http-equiv="refresh" content="3;
URL='http://www.pint.com/'" />


<!-- Use of the META element to add rating information -->
<meta http-equiv="PICS-Label" content="(PICS-1.1
'http://www.rsac.org/ratingsv01.html'
1 gen true comment 'RSACi North America
Server' by 'webmaster@bigcompany.com'
for 'http://www.bigcompany.com' on
'1999.05.26T13:05-0500'
r (n 0 s 0 v 0 l 1))" />


Compatibility


HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5 – 4.8, 6, 7
Opera 4 – 7

Notes


The meta element can occur only in the head element. It can be defined multiple times.
The meta element is an empty element (as defined in the HTML specifications) and does not have a closing tag nor contain any content. However, under XHTML 1.0, empty elements such as <meta> require a trailing slash: <meta />.

A common use of the meta element is to set information for indexing tools, such as search engines. Common values for the name attribute when performing this function include author, description, and keywords; other attributes also might be possible.

The http-equiv attribute is often used to create a document that automatically loads another document after a set time. This is called client-pull. An example of a client-pull meta element is <meta http-equiv="refresh" content="10;URL='nextpage.html'" />. Note that the content attribute contains two values. The first is the number of seconds to wait, and the second is the identifier URL and the URL to load after the specified time.

The http-equiv attribute is also used for page ratings, cache control, setting defaults such as language or scripting, and a variety of other tasks. In many cases, it would be better to set these values via the actual HTTP headers rather than via a <meta> tag.

The HTML 2.0 and 3.2 specifications define only the content, http-equiv, and name attributes.

(X)HTML Elements
CSS Properties
Previous: menu Next: multicol
< Home | About | Chapters | Examples | Errata | Reference | Site Map >