HTML5 <meta> Tag

Example

Describe metadata:

<head>
<meta name="description" content="Free Web tutorials" />
<meta name="keywords" content="HTML,CSS,XML,JavaScript" />
<meta name="author" content="Ståle Refsnes" />
<meta charset="UTF-8" />
</head>

Try it yourself »

Definition and Usage

The <meta> element provides meta-information about your page, such as descriptions and keywords for search engines and refresh rates.


Differences Between HTML 4.01 and HTML5

The scheme attribute is not supported in HTML5.

HTML5 has a new attribute, charset, which makes it easier to define charset.

Example, define charset:

HTML 4.01:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
HTML5:
<meta charset="UTF-8">


Tips and Notes

Note: The <meta> tag always goes inside the head element.

Note: Metadata is always passed as name/value pairs.

Note: One, and not more, of these attributes must be defined: charset, http-equiv, name.

Note: The content attribute MUST be defined if the name or the http-equiv attribute is defined. if none of these are defined, the content attribute CANNOT be defined.


Examples

Define keywords for search engines:
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript" />

Define a description of your web page:
<meta name="description" content="Free Web tutorials on HTML and CSS" />

Define the last revision of your page:
<meta name="revised" content="Kai Jim Refsnes, 13/01/2011" />

Refresh page every 5 seconds:
<meta http-equiv="refresh" content="5" />


Attributes

New : New in HTML5.

Attribute Value Description
charsetNew character encoding Defines the character encoding for the document
content some_text Defines meta information to be associated with http-equiv or name
http-equiv content-type
expires
refresh
set-cookie
Connects the content attribute to an HTTP header
name author
description
keywords
generator
others
Connects the content attribute to a name
scheme format/URI Not supported in HTML5

Standard Attributes

The <meta> tag also supports the Standard Attributes in HTML5.