Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The HTMLMetaElement interface contains descriptive metadata about a document provided in HTML as <meta> elements. This interface inherits all of the properties and methods described in the HTMLElement interface.
EventTarget Node Element HTMLElement HTMLMetaElementInherits properties from its parent, HTMLElement.
<meta#charset>The character encoding for a HTML document.
HTMLMetaElement.contentThe 'value' part of the name-value pairs of the document metadata.
HTMLMetaElement.httpEquivThe name of the pragma directive, the HTTP response header, for a document.
HTMLMetaElement.mediaThe media context for a theme-color metadata property.
HTMLMetaElement.nameThe 'name' part of the name-value pairs defining the named metadata of a document.
HTMLMetaElement.schemeDefines the scheme of the value in the HTMLMetaElement.content attribute. This is deprecated and should not be used on new web pages.
No specific method; inherits methods from its parent, HTMLElement.
The following two examples show a general approach to using the HTMLMetaElement interface. For specific examples, see the pages for the individual properties as described in the Instance properties section above.
The following example creates a new <meta> element with a name attribute set to description. The content attribute sets a description of the document and is appended to the document <head>:
The following example shows how to create a new <meta> element with a name attribute set to viewport. The content attribute sets the viewport size and is appended to the document <head>:
For more information on setting the viewport, see <meta name="viewport">.
| HTML # htmlmetaelement |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Oct 17, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.