HTML <meta>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <meta>
tag provides structured metadata about the document. The <meta>
element may only appear in the head section of a document, although it may appear any number of times.
The following table summarizes the usages context and the version history of this tag.
Parent: | <head> |
---|---|
Content: | None. It is an empty element. |
Start/End Tag: | Start tag: required, End tag: forbidden |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
Note: Metadata is data (information) about data – for example, keywords and description that relate to the document.
The <meta>
tag commonly used to provide keywords, descriptions, author information, and other metadata that may be used by the browser to render the document correctly, or it may be used by the search engines for indexing purposes. Here's some real world examples to help you understand <meta>
tag.
Example 1: Define the character encoding for the document
Example 2: Defines the author name of the document
Example 3: Defines a list of keywords for search engines
Example 4: Define a brief summery/description of the web page
Example 5: Enable zooming in mobile devices
Syntax
The basic syntax of the <meta>
tag is given with:
XHTML:<meta name="text" content="text" />
The example below shows the <meta>
tag in action.
Example
Try this code »<head>
<title>Example of HTML meta tag</title>
<meta charset="UTF-8">
<meta name="keywords" content="HTML,CSS,References,Examples">
<meta name="description" content="Free Web tutorials">
</head>
Tag-Specific Attributes
The following table shows the attributes that are specific to the <meta>
tag.
Attribute | Value | Description |
---|---|---|
Required — One of the following attributes must be specified for the markup to be valid. | ||
name |
application-name |
Defines a name for the meta-information contained in the content attribute. |
content |
text | Gives the value associated with the http-equiv or name attribute. This attribute must be specified if either http-equiv or name attribute is present. |
charset |
character-set | Specifies the character encoding for the HTML document. |
http-equiv |
content-type |
Binds the meta-information in the content attribute to an HTTP response header. |
Optional — The following attribute is optional. | ||
scheme |
format/URI | Obsolete Specifies a scheme to be used to interpret the value of the content attribute. |
Global Attributes
Like all other HTML tags, the <meta>
tag supports the global attributes in HTML5.
Event Attributes
The <meta>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <meta>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Meta.
Related tag: <head>
.