HTML/Elements/meta

From Web Education Community Group
< HTML‎ | Elements
Revision as of 17:17, 18 November 2011 by Rworth (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<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]

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.
    • content-language
      Sets the pragma-set default language.
    • content-type
      Alternative form of setting the charset attribute
    • default-style
      Sets the name of the default alternative style sheet set.
    • refresh
      Acts as timed redirect. [Example B]


  • 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 charset=utf-8" />
  <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">

HTML Reference

The HTML5 specification defines the <meta> element in 4.2.5 The meta element.