HTML/Elements/meta
From W3C Wiki
Contents
<meta>
The <meta> element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements.
Point
- Exactly one of the name, http-equiv, and charset attributes must be specified.
- If either name or http-equiv is specified, then the content attribute must also be specified. Otherwise, it must be omitted.
HTML Attributes
name
= string
Sets document metadata.- application-name
Giving the name of the Web application that the page represents. - author
Giving the name of one of the page's authors. - description
Describes the page. [Example A] - generator
Identifies one of the software packages used to generate the document. - keywords
Giving the keyword relevant to the page. [Example A]
- application-name
Other metadata names may be registered in the WHATWG Wiki MetaExtensions page.
http-equiv
= string
When the http-equiv attribute is specified on a meta element, the element is a pragma directive. You can use this element to simulate an HTTP response header, but only if the server doesn't send the corresponding real header; you can't override an HTTP header with ameta http-equiv
element.[1]
Values are those in Section 14 of the HTTP standard. Some of the most common ones[2] include:- content-language
Sets the pragma-set default language. - content-type
Alternative form of setting the charset attribute - default-style OR content-style-type
Sets the name of the default alternative style sheet set. - refresh
Acts as timed redirect. [Example B] - Allow
Defines methods allowed by server (GET, POST etc.) - Content-Encoding
Define the the encoding type of the returned data - Content-Length
- Date
Document creation date - Expires
Expiration date - Last-Modified
Date when document was last modified - Location
Absolute URL pointing to the document - Set-Cookie
- content-language
content
= string
Gives the value of the document metadata or pragma directive when the element is used for those purposes.
charset
= character encoding name
Specifies the character encoding used by the document. [Example A]
See also global attributes.
Example
Example A
<head> <title>World Wide Web Consortium (W3C)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="copyright" content="© W3C" /> <meta name="author" lang="en" content="" /> <meta name="robots" content="Index,Follow" /> <meta name="description" content="The World Wide Web Consortium (W3C) is an international community where Member organizations, a full-time staff, and the public work together to develop Web standards." /> <meta name="keyword" content="W3C, HTML, CSS, SVG, Web standards" /> </head>
Example B
A news organization's front page could include the following markup in the page's head element, to ensure that the page automatically reloads from the server every five minutes:
<meta http-equiv="Refresh" content="300">
You can also use meta refresh to redirect.
<meta http-equiv="Refresh" content="X;url=http://w3.org/">
Where X = Time.
NOTE: Most search bots will actually remove your site from their list if you overuse meta refresh; try to use 301 redirection instead.
HTML Reference
The HTML5 specification defines the <meta> element in 4.2.5 The meta element.