meta (HTML element)

Spec
Depr. Empty Version
No Yes HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

<meta content="string"  { http-equiv="http response header" | name="string" } />

Description

The meta element provides information about the following document content; that information may be used by the user agent (that is, the browser) to decide how to render content, or it may be meta information that’s provided for indexing purposes—for example, to provide keywords that relate to the document for use by search engines or some other form of web service. The meta element can also be used to simulate HTTP response headers (the character encoding snippet provided here is an example of this), or it might simply be used for the purposes of causing a document to reload itself after a set interval.

There’s not a standard list of meta properties (although the Dublin Core initiative aims to correct that), so it would be perfectly valid to define the following meta properties:

<meta name="department" content="Technology">
<meta name="author" content="John Smith">

This definition would also be perfectly valid:

<meta name="appearance" content="fluffy">

While you can define your own meta information, the question you should ask is whether or not it adds any value. Unless you intend to use this element for the purposes of indexing, you’re advised to stick to a handful of tried-and-tested meta tags:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!— sets character encoding —>

<meta http-equiv="Refresh" content="5">
<!— refreshes the page content every five seconds —>

The following meta tags are the most relevant in terms of search engine indexing and interpretation:1

<meta name="robots" content="noindex,follow">
<!— instructs search engines not to index this page, but to follow links from the page —>

<meta name="description" content="A brief
    summary/description of the content on the page,
    which may appear in search engine results">

<meta name="keywords" content="reference, SitePoint,
    HTML, XHTML, standards">
<!—comma-separated list of keywords that apply to the page —>

The search engines’ declining interest in the "description" and "keywords" meta elements may mean that it’s preferable for us to drop them entirely. As with all meta elements, there is a danger that, because they are hidden from normal page view, the content can easily go out of date. So unless you know for a fact that the content in these types of meta elements is going to be properly maintained and that they are in some way beneficial (and this is more likely to be the case when they’re used in an intranet where this information may be properly indexed), not using them at all may be the best course of action.

Note: Optimizing meta Elements? Don’t Waste Your Time!

Many search engine optimization (SEO) experts still insist that there’s some value in including the "description" and "keywords" meta elements. However, most of these specialists are not party to the ways in which the various search engines actually work. Their advice is largely based on experience, assumption, reverse engineering, common sense, observed patterns—the list goes on. In short, they can’t be certain how the likes of Google, Yahoo, Live, Ask, and others handle this content. Certainly, evidence suggests that your efforts are best spent on other aspects of the document whose search ranking you wish to improve.

The syntax of the examples above is appropriate for HTML documents. For XHTML documents, you must remember to include the trailing / character (although it should be noted that there would be little point in adding a Content-Type header as content="text/html; charset=UTF-8" if the document is supposed to be XHTML!). This example shows the XHTML syntax:

<meta name="robots" content="noindex,follow"/>
<!— the robots meta tag expressed in XHTML syntax —> 

The "robots" meta tag is used to tell robots (that is, search engine crawlers) not to index the content of a page, nor to scan it for links to follow. Different search engines interpret the "robots" meta tag differently. For more information about the potential attribute values and their uses, refer to the Search Engine Land article “Meta Robots Tag 101: Blocking Spiders, Cached Pages & More.”

Example

Here, a meta element is used to identify character encoding in an HTML document:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Use This For …

The meta element provides information about the document that won’t render on the page, but will be machine-parsable.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Full support is provided for the meta element—all browsers expose a document’s meta information via the Document Object Model.

In this Section

Footnotes

1 Note that the importance of this information has dropped dramatically over the years, as a result of webmasters spamming search engines by stuffing irrelevant content into the "keywords" and "description" meta tags.

User-contributed notes

ID:
#2
Contributed:
by JdL
Date:
Tue, 19 Aug 2008 15:58:01 GMT

While no standard list of meta properties currently exists, there are a very large number that people would find useful. Would you consider updating this page to have at least a base level list of properties and some description / uses around them? It would be most helpful!!

Examples:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -- Helpful descriptor for SEO, crawlers, content aggregators, etc.

<meta http-equiv="Content-Language" content="en-us" /> -- Useful for screenreaders, mobile phones, and international browsers

<meta http-equiv="Pragma" content="no-cache" /> -- Prevents some browsers from caching content of the page.

<meta http-equiv="imagetoolbar" content="false" /> -- Prevents IE browsers from displaying the image tool bar when the cursor hovers over static images.

Related Products