Join us Now |  Forgot Password? | Forgot UserName?


Learn step by step

HTML Meta Tags

HTML lets you define metadata - information about a document rather than document content -in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words etc.
The <meta> tag is an empty element and thus does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element.
Metadata is a very important part of the web. It can assist search engines to find best match. Search engines will often look for any metadata attached to a page - especially keywords, description - and rank it higher than another page with less relevant metadata, or with no metadata at all.

Adding Meta Tags to Your Documents:

We can add metadata to any web pages by placing <meta> tags between the <head> and </head> tags. We can include the following attributes:

Attribute Description
Name Name for the property can be anything. For e.g. keywords, description, author, revised, generator etc.
Content Specifies the property's value.
Scheme Defines a scheme to interpret the properties value (as declared in the content attribute).
http-equiv Used for http response message headers. For example http-equiv attribute can be used to refresh the page or to set a cookie. Some of more examples include content-type, expires, refresh and set-cookie

NOTE:Core attributes for all the elements are discussed in next chapter.

Meta Tag Examples:

Let's see few important leverages of Meta Tags.

Specifying Keywords:

Keywords are used by search engine to search a web page. So by using following tag you can specify important keywords related to your page.

<meta name="keywords" content="HTML, meta tags, metadata" />
Document Description:

This is again important information and many search engine use this information while searching a web page. So you should give an appropriate description of the page.

<meta name="description" content="Learn about Meta Tags." />
Page Redirection:

You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be automatically redirected.

<meta http-equiv="refresh" content="10; url=http://www.tuton.orianaitsolutions.com" />

If a duration is not provided then page will be redirected immediately.

Setting Cookies:

Meta Tag can be used to store cookies on client side later information can be used by Web Server to track a site visitor.

<meta http-equiv="cookie" content="userid=user1; expires=Wednesday, 08-Aug-00 23:59:59 GMT;/>

If the expiration date and time is not included, the cookie is considered a session cookie and will be deleted when the user exits the browser.

Setting Author Name:

Author name can be set in a web page using Meta Tag. See an example below:

<meta name="author" content="Alchemar"/>

Related Videos