HTML <meta>
Tag
Example
Describe the metadata of an HTML document:
<head>
<meta name="description" content="Free online tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="tutorialpro">
<meta charset="UTF-8">
</head>
Browser Support
All major browsers support the <meta>
tag.
Definition and Usage
Metadata is data (information) about data.
The <meta>
tag provides metadata about the HTML document. Metadata will not be displayed on the page, but is machine parsable.
Meta elements are typically used to specify page description, keywords, document author, last modified, and other metadata.
Metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.
Tips and Notes
Note: The <meta>
tag is often placed within the <head>
area.
Note: Metadata is usually represented as name/value pairs.
Note: If the name
attribute is not provided, the name part of the name/value pair will use the value of the http-equiv
attribute.
Differences Between HTML 4.01 and HTML5
HTML5 does not support the scheme
attribute.
In HTML5, a new charset
attribute makes defining the character set easier:
HTML 4.01:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
HTML5:
<meta charset="UTF-8">
Differences Between HTML and XHTML
In HTML, the <meta>
tag has no closing tag.
In XHTML, the <meta>
tag must be properly closed.
Examples
Example 1 - Define document keywords for search engines:
Example 2 - Define web page description:
Example 3 - Define page author:
Example 4 - Refresh the page every 30 seconds:
Attributes
Attribute | Value | Description |
---|---|---|
charset New | character_set | Defines the character encoding for the document. |
content | text | Defines the metadata associated with either http-equiv or name . |
http-equiv | content-type <br>default-style <br>refresh | Associates the content attribute with an HTTP header. |
name | application-name <br>author <br>description <br>generator keywords | Associates the content attribute with a name. |
scheme | format/URI | Not supported in HTML5. Defines a format for the value of the content attribute. |
Event Attributes
The <meta>
tag supports all HTML event attributes.
Related Articles
HTML Tutorial: HTML Head