HTML

HTMLMetaElement

HTMLMetaElement <meta>

Descriptive metadata about a document is present via the HTMLMetaElement interface. All of the methods and properties listed in the HTMLElement interface are inherited by it.

An HTML document's metadata is defined via the <meta> tag. Data about data is referred to as metadata. The character set, page description, keywords, document author, and viewport settings are all commonly specified using <meta> elements, which are always placed inside the <head> element. Metadata will not be displayed on the page, but is machine parsable. Search engines (keywords), browsers (how to show content or reload page), and other web services all employ metadata. There is a method to let web designers take control over the viewport (the user's visible area of a web page), through the <meta> tag.

Attribute Value Description Example
download character_set Specifies the character encoding for the HTML document.The HTML5 specification encourages web developers to use the UTF-8 character set! <head> <meta charset="UTF-8"> </head>
content text Specifies the value associated with the http-equiv or name attribute <head> <meta name="description" content="Free Web tutorials"> <meta name="keywords" content="HTML,CSS,XML,JavaScript"> </head>
http-equiv content-security-policy Specifies a content policy for the document. <meta http-equiv="content-security-policy" content="default-src 'self'">
content-type Specifies the character encoding for the document. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
default-style Specified the preferred style sheet to use. <meta http-equiv="default-style" content="the document's preferred stylesheet">
refresh Defines a time interval for the document to refresh itself. <meta http-equiv="refresh" content="300">
name application-name Specifies the name of the Web application that the page represents
author Specifies the name of the author of the document. <meta name="author" content="John Doe">
description Specifies a description of the page. Search engines can pick up this description to show with the results of searches. <meta name="description" content="Free web tutorials">
generator Specifies one of the software packages used to generate the document (not used on hand-authored pages). <meta name="generator" content="FrontPage 4.0">
keywords Specifies a comma-separated list of keywords - relevant to the page (Informs search engines what the page is about). <meta name="keywords" content="HTML, meta tag, tag reference">
viewport Controls the viewport (the user's visible area of a web page). The viewport varies with the device, and will be smaller on a mobile phone than on a computer screen.The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser. <meta name="viewport" content="width=device-width, initial-scale=1.0">

Browser Compatibility

Element Chrome Edge Firefox Safari Opera
<meta> Yes Yes Yes Yes Yes