HTML <meta> Tag

The <meta> element is a special HTML tag that provides information about a Web page.

Metadata isn't displayed on the page. Meta elements are generally used for page descriptions, keywords, author of the document, and other metadata.

<meta> tag is always used inside <head> element.

You must define the content attribute if the name or the http-equiv attributes are defined. If these attributes are not defined, the content attribute cannot be defined either.

The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.

Syntax

The <meta> tag is a no end tag in HTML, however, it must be properly closed in XHTML.

Example

Define the keyword for the search engines:

<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">

Define the website description:

<meta name="description" content="Tutorials on HTML , CSS and PHP">

Define the author of the page:

<meta name="author" content="myauthor">

Refresh the document every one minute (60 seconds):

<meta http-equiv="refresh" content="60">

Set the viewport to make the website look good on all devices:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Attributes

Attribute Value Description
charset character_set Defines the character encoding for the document.
content text Gives value related to the http-equiv or name attribute.
http-equiv content-type
default-style
refresh
Is used to provide HTTP header for the information/value of the content attribute.
name application-name
author
description
generator
keywords
Defines the name for metadata.
scheme format/url Defines scheme to be used to interpret the value of the content attribute.
This attribute is not used anymore after HTML5.

The <meta> tag also supports the Global Attributes.