Meta elements are used to specify general information about the webpage, and are often used as a substitute for proper HTTP headers (a practice which should be avoided if at all possible). These elements are found in the document head.
<meta content="text"‡ dir="ltr | rtl" http-equiv="http header string" lang="language code" name="name of meta information" scheme="scheme type" >
‡ = Required attribute
** = Transitional only
Explanation of attributes
content‡: used to contain the actual meta information. The value of this attribute, and the form in which it is specified, depends on the value of the name attribute.
dir: used to set the direction of the text in combination with the language set in the lang attribute. The available values are "ltr" (left to right) and "rtl" (right to left), with the default value being "ltr".
http-equiv: this attribute is used to specify that the value of the content attribute is a HTTP header. This attribute should not be used if the name attribute is present. One thing to note about the use of meta elements for HTTP headers is that they should not be used if it is possible to send the header value through server-side scripting, as they are less effective and not guaranteed to work in all instances.
lang: used to indicate the language being used in the text contained within the element. The value of this attribute takes on the form of the ISO standard lanuage abbreviations found in RFC 3066. A list of these codes can be found on the ISO language codes page.
name: used to specify the type of meta information that is present in the content attribute. This attribute should not be used if the http-equiv attribute is present.
scheme: this attribute is used to indicate the format of the value of the content attribute. In practice, this attribute is neither used nor supported.
No event handlers are defined for this element.
The example below shows how to use a meta element to provide document keywords for use in some search engines.
<meta name="keywords" content="keywords, separated, by, commas">
The next example is one utilizing http-equiv in order to add a ratings label to the page. This label is specific to the webpage (or website) that is it found on; more information can be found on the Internet Content Rating Association website.
<meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://www.webpageworkshop.co.uk" r (cz 1 lz 1 nz 1 oz 1 vz 1) "" l gen true for "http://www.webpageworkshop.co.uk" r (n 0 s 0 v 0 l 0))'>
The final example is one showing the use of meta elements to refresh a page, or redirect the user to another page after a specific time period.
<meta http-equiv="refresh" content="3;URL='http://www.webpageworkshop.co.uk/'">
|Basic element support|
The browser icons are explained in the below list:
= Microsoft Internet Explorer 6+
= Netscape Communicator 4
= Mozilla and Netscape Navigator 6+
= Opera 7+
= MSN TV (aka. WebTV)
= Konqueror 3.0+