--- title: ': The Document-level Metadata element' slug: Web/HTML/Element/meta translation_of: Web/HTML/Element/meta ---
{{HTMLRef}}

The HTML <meta> element represents {{Glossary("Metadata","metadata")}} that cannot be represented by other HTML meta-related elements, like {{HTMLElement("base")}}, {{HTMLElement("link")}}, {{HTMLElement("script")}}, {{HTMLElement("style")}} or {{HTMLElement("title")}}.

Content categories Metadata content. If the {{htmlattrxref("itemprop", "meta")}} attribute is present: flow content, phrasing content.
Permitted content None, it is an {{Glossary("empty element")}}.
Tag omission As it is a void element, the start tag must be present and the end tag must not be present.
Permitted parents <meta charset>, <meta http-equiv>: a {{HTMLElement("head")}} element. If the {{htmlattrxref("http-equiv", "meta")}} is not an encoding declaration, it can also be inside a {{HTMLElement("noscript")}} element, itself inside a {{HTMLElement("head")}} element.
Permitted ARIA roles None
DOM interface {{domxref("HTMLMetaElement")}}

Attributes

This element includes the global attributes.

Note: the global attribute {{htmlattrxref("name", "meta")}} has a specific meaning for the {{HTMLElement("meta")}} element, and the {{htmlattrxref("itemprop", "meta")}} attribute must not be set on the same <meta> element that has any existing {{htmlattrxref("name", "meta")}}, {{htmlattrxref("http-equiv", "meta")}} or {{htmlattrxref("charset", "meta")}} attributes.

{{htmlattrdef("charset")}}
This attribute declares the page's character encoding. It must contain a standard IANA MIME name for character encodings. Although the standard doesn't request a specific encoding, it suggests:

Note: ASCII-incompatible encodings are those that don't map the 8-bit code points 0x20 to 0x7E to the 0x0020 to 0x007E Unicode code points)

  • Authors must not use CESU-8, UTF-7, BOCU-1 and/or SCSU as cross-site scripting attacks with these encodings have been demonstrated.
  • Authors should not use UTF-32 because not all HTML5 encoding algorithms can distinguish it from UTF-16.
Notes:
  • The declared character encoding must match the one the page was saved with to avoid garbled characters and security holes.
  • The {{HTMLElement("meta")}} element declaring the encoding must be inside the {{HTMLElement("head")}} element and within the first 1024 bytes of the HTML as some browsers only look at those bytes before choosing an encoding.
  • This {{HTMLElement("meta")}} element is only one part of the algorithm to determine a page's character set. The Content-Type header and any {{Glossary("Byte-Order Mark","Byte-Order Marks")}} override this element.
  • It is strongly recommended to define the character encoding. If a page's encoding is undefined, cross-scripting techniques are possible, such as the UTF-7 fallback cross-scripting technique.
  • The {{HTMLElement("meta")}} element with a charset attribute is a synonym for the pre-HTML5 <meta http-equiv="Content-Type" content="text/html; charset=IANAcharset">, where IANAcharset contains the value of the equivalent {{htmlattrxref("charset", "meta")}} attribute. This syntax is still allowed, although no longer recommended.
{{htmlattrdef("content")}}
This attribute contains the value for the {{htmlattrxref("http-equiv", "meta")}} or {{htmlattrxref("name", "meta")}} attribute, depending on which is used.
{{htmlattrdef("http-equiv")}}
Defines a pragma directive. The attribute is named http-equiv(alent) because all the allowed values are names of particular HTTP headers:
{{htmlattrdef("name")}}

This attribute defines the name of a piece of document-level metadata. It should not be set if one of the attributes {{htmlattrxref("itemprop", "meta")}}, {{htmlattrxref("http-equiv", "meta")}} or {{htmlattrxref("charset", "meta")}} is also set.

This metadata name is associated with the value contained by the {{htmlattrxref("content", "meta")}} attribute. The possible values for the name attribute are:

This attribute may also have a value taken from the extended list defined on WHATWG Wiki MetaExtensions page. Although none have been formally accepted yet, a few commonly used names are:

{{htmlattrdef("scheme")}} {{obsolete_inline}}
This attribute defines the scheme in which metadata is described. A scheme is a context leading to the correct interpretations of the {{htmlattrxref("content", "meta")}} value, like a format.

Warning: Do not use this value, as it is obsolete. There is no replacement as there was no real usage for it.

Notes

Depending on the attributes set, the kind of metadata can be one of the following:

Examples

<meta charset="utf-8">

<!-- Redirect page after 3 seconds -->
<meta http-equiv="refresh" content="3;url=https://www.mozilla.org">

Accessibility concerns

Refreshing content

Pages set with a refresh value run the risk of having the time interval being too short. People navigating with the aid of assistive technology such as a screen reader may be unable to read through and understand the page's content before being automatically redirected. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions. 

Viewport scaling

Disabling zooming capabilities by setting user-scalable to a value of no prevents people experiencing low vision conditions from being able to read and understand page content.

Specifications

Specification Status Comment
{{SpecName('Referrer Policy', '#referrer-policy-delivery-meta', '<meta name="referrer">')}} {{Spec2('Referrer Policy')}} Defines values and semantics of <meta name="referrer">.
{{SpecName('HTML WHATWG', 'semantics.html#the-meta-element', '<meta>')}} {{Spec2('HTML WHATWG')}} Added itemprop attribute
{{SpecName('HTML5 W3C', 'document-metadata.html#the-meta-element', '<meta>')}} {{Spec2('HTML5 W3C')}} Added charset attribute
{{SpecName('HTML4.01', 'struct/global.html#h-7.4.4.2', '<meta>')}} {{Spec2('HTML4.01')}}  

Browser compatibility

The information shown below has been pulled from MDN's Github (https://github.com/mdn/browser-compat-data).

{{Compat("html.elements.meta")}}

See also