Syntax | HTML syntax - This element does not require a closing tag.
<meta> XHTML syntax - This element is opened and closed, within a single tag, by adding a space followed by a forward slash at the end of the tag. <meta /> |
---|---|
Usage | The <meta> tag can be used to supply additional information, or metadata, about the current web page. The <meta> tag appears in the head section between the opening and closing <head> tags. The <meta> tag uses either the name or http-equiv attribute to specify a property and the content attribute to specify a value for the property. The following is an example of using the <meta> tag to provide keyword information that can be used by search engines: HTML <meta> example: <meta name="keywords" content="html, css, javascript">
XHTML <meta> example:
<meta name="keywords" content="html, css, javascript" />
The following is an example of using the <meta> tag to provide a description of the web page. This information may be used by search engines: HTML <meta> example: <meta name="description" content="Web Page Design">
XHTML <meta> example:
<meta name="description" content="Web Page Design" />
The following is an example of using the <meta> tag to re-load a web page after a specified number of seconds. In this example is it 300 seconds. This technique can be used to automatically refresh a web page that has frequently changing content like would be the case for a website that displays the current temperature: HTML <meta> example: <meta http-equiv="refresh" content="300">
XHTML <meta> example:
<meta http-equiv="refresh" content="300" /> The following is an example of using the <meta> tag to set the default style sheet language, for the current web page, to Cascading Style Sheets (CSS). HTML <meta> example: <meta http-equiv="Content-Style-Type" content="text/css">
XHTML <meta> example:
<meta http-equiv="Content-Style-Type" content="text/css" />
The following is an example of using the <meta> tag to set the default scripting language, for the current web page, to JavaScript. HTML <meta> example: <meta http-equiv="Content-Script-Type" content="text/javascript">
XHTML <meta> example:
<meta http-equiv="Content-Script-Type" content="text/javascript" /> The following is an example of using the <meta> tag to provide the Internet Media Type and language for the web page. In this case the language is English: HTML <meta> example: <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
XHTML <meta> example:
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
OR
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
When using XHTML version 1.0, the Internet Media Type can be set to "text/html" if the "HTML Compatibility Guidelines" are followed. See XHTML 1.0 The Extensible HyperText Markup Language (Second Edition) for more details. Reference section "5.1. Internet Media Type" and "Appendix C." |
Content Model | The <meta> element cannot contain any tags. |
Required | Tag Specific | Core | Focus | Events | Language |
---|---|---|---|---|---|
content | http-equiv name scheme | id1 | dir lang xml:lang1 | ||
Notes: 1. XHTML only. |
Attribute | Description |
---|---|
content | The content attribute specifies the value for the property. The property is specified using either the name or http-equiv attribute. The following is an example of using the <meta> tag to provide keyword information that can be used by search engines: HTML <meta> tag example: <meta name="keywords" content="html, css, javascript">
XHTML <meta> tag example: <meta name="keywords" content="html, css, javascript" /> Note: This is a required attribute. |
http-equiv | The http-equiv attribute specifies a value that can be used to create a header in the HTTP response. Either the name or http-equiv attribute should be used to specify a property for the <meta> tag. The following is an example of using the <meta> tag to load a web page after a specified number of seconds. In this example is it 300 seconds. This technique can be used to automatically refresh a web page that has frequently changing content like would be the case for a website that displays the current temperature: HTML <meta> tag example: <meta http-equiv="refresh" content="300;url='temperature.html'">
XHTML <meta> tag example: <meta http-equiv="refresh" content="300;url='temperature.html'" /> |
name | The name attributes is used to specify a property. Either the name or http-equiv attribute should be used to specify a property for the <meta> tag. The following is an example of using the <meta> tag to provide a description of the web page. This information may be used by search engines: HTML <meta> tag example: <meta name="description" content="Web Page Design">
XHTML <meta> tag example: <meta name="description" content="Web Page Design" /> |
scheme | The scheme attribute provides additional information that can be used to interpret the value of the property. HTML <meta> tag example: <meta name="identifier" scheme="isbn" content="978-0596101992">
XHTML <meta> tag example: <meta name="identifier" scheme="isbn" content="978-0596101992" /> |
id | The id attribute assigns a unique name to a tag. This allows style sheets or scripts to reference the tag. See id Example Note: XHTML only. |
dir | The dir attribute tells the browser whether the text should be displayed from left-to-right or right-to-left. It does not reverse the direction of the characters, like the <bdo> tag does, but it can help the browser to determine if the text should be aligned on the left side or the right side. See dir Example |
lang | The lang attribute specifies a language. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See lang Example |
xml:lang | The xml:lang attribute specifies a language for XHTML documents. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See xml:lang Example Note: XHTML only. |