HTML & CSS Wiki
Advertisement

The void HTML <meta /> element, or metadata, informs the browser about some aspect of how a page should be handled. It's the catch-all among elements that go within the head, taking all sorts of different values which were not alotted their own tags. It represents any metadata information which cannot be represented using one of the another meta-related elements (<base />, <link />, <script>, <style>, or <title>).

Attributes

Attribute Value Description
charset name This attribute declares the character set used of the page. It can be locally overriden using the lang attribute on any element. This attribute is a literal string and must be one of the preferred MIME name for a character set as defined by the IANA. (HTML5)
content value This attribute gives the value associated with the http-equiv or name attribute, depending on the context.
http-equiv content value This enumerated attribute defines the pragma that can alter servers and user-agents behavior. The value of the pragma is defined using the content and can be one of the following:
*content-language - This pragma defines the default language of the page. Obsolete*content-type - This attribute defines the MIME type of the document, eventually followed by its character set. It follows the same syntax as the HTTP content-type entity-header field, but as it is inside an HTML element, most values are not possible. Therefore the valid syntax for its content is the literal string 'text/html' eventually followed by a character set with the following syntax: '; charset=IANAcharset' where IANAcharset is the preferred MIME name for a character set as defined by the IANA. Obsolete
default-style value This pragma specifies the preferred stylesheet to be used on the page. The content attribute must contains the id of a <link /> element whose href attribute links to a CSS stylesheet, or the id of a <style> element which contains a CSS stylesheet.
refresh value This pragma specifies:


  • The number of seconds until the page should be reloaded, if the content attribute contains only a positive integer number;
  • The number of seconds until the page should be redirected to another, if the content attribute contains a positive integer number followed by the string ';url=' and a valid URL.
name name This attribute defines the name of a document-level metadata. It should not be set if the attributes http-equiv or charset is also set. This document-level metadata name is associated with a value, contained by the content attribute. The possible values for the name element are, with their associated value stored via the content attribute:
  • application-name - Defines the name of the web application running in the webpage;
  • author - Defines, in a free format, the name of the author of the document;
  • description - Contains a short and accurate summary of the content of the page. Several browsers, among them Firefox and Opera, use this meta as the default description of the page when bookmarked;
  • generator - Contains, in a free format, the identifier to the software that generated the page;
  • keywords - Contains, as strings separated by commas, relevant words associated with the content of the page.
  • creator - Defines, in a free format, the name of the creator of the document. Note that it can be the name of the institution. If there are more than one, several <meta /> elements should be used;
  • googlebot - A synonym of robots, but is only followed by Googlebot, the indexing crawler for Google;
  • publisher - Defines, in a free format, the name of the publisher of the document. Note that it can be the name of the institution;
  • robots - Defines the behavior that cooperative crawlers should have with the page.
  • slurp - A synonym of robots, but is only followed by Slurp, the indexing crawler for Yahoo Search;
  • viewport - Gives hints about the size of the initial size of the viewport. This pragma is used by several mobile devices only.


HTML example:

<meta http-equiv="Refresh" content="5; URL=http://www.foo.com/foo.html" />

External links

Advertisement