<meta/> Metatags in HTML 5
The <meta>
tag is used to define metadata for the HTML document or directions for the HTTP protocol. HTML metatag
elements have a content
attribute and either a name
attribute for document metadata or an http-equiv
attribute for protocol directives.
<meta name="..." content="..."/> <meta http-equiv="..." content="..."/>
Other metadata can be expressed using specific HTML tags, such as:
Rules for coding HTML metatag
elements
- Code any <meta> tags in the <head> section of the HTML document.
- Each meta element consists of a standalone <meta/> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - Code either a
name=
attribute or anhttp-equiv=
attribute, but not both. The value of the attribute, which is enclosed in double quotes, is the name of the metadata or directive. - Code a
content=
attribute with the value for the named metadata or directive in double quotes. - Since the
<meta/>
tag is a void element, it should always be coded as a self-closing tag terminated with the delimiters/>
.
List of <meta> tags in HTML 5
Most Common Metatags
The most common HTML metatags include:
Metatags for Search Engine Optimization (SEO)
- <meta name="description"/> tag
- <meta name="google"/> tag
- <meta name="googlebot"/> tag
- <meta name="keywords"/> tag
- <meta name="robots"/> tag
- <meta name="verify"/> tag
Metatags for HTML pages on Mobile / Handheld Devices
- <link rel="apple-touch-icon/> tag for Web Clips
- <meta name="format-detection"/> tag
- <meta name="HandheldFriendly"/> tag
- <meta name="viewport"/> tag
Metatags for Apps on Mobile / Handheld Devices
- <meta name="apple-mobile-web-app-capable"/> tag
- <meta name="apple-mobile-web-app-status-bar-style"/> tag
- <link rel="apple-touch-startup-image/> tag
<meta http-equiv="..."/> tags
- <meta http-equiv="default-style"/> tag
- <meta http-equiv="refresh"/> tag
- <meta http-equiv="Cache-Control"/> tag
- <meta http-equiv="Content-Disposition"/> tag
- <meta http-equiv="Content-Type"/> tag
- <meta http-equiv="Expires"/> tag
- <meta http-equiv="X-UA-Compatible"/> tag
Less common HTML metatags include:
- <meta name="application-name"/> tag
- <meta name="author"/> tag
- <meta name="classification"/> tag
- <meta name="copyright"/> tag
- <meta name="formatter"/> tag
- <meta name="generator"/> tag
- <meta name="rating"/> tag
Changes in HTML 5
- The
<meta charset="..."/>
tag should no longer be used because it is supported only for the purpose of migrating from xHTML.