What are Meta Tags in HTML?

We can specify metadata in HTML – an additional important information about the document in different ways. We can include name/value pairs which describe properties of HTML document using META elements, like author, list of keywords, expiry date, document author etc.

That additional information is provided by <meta> tag. This tag stores information within its attributes and does not have closing tag even though it is an empty element.

One or more meta tags can be included in a document based information you want to have in your document but meta tags do not impact physical appearance of the document so from appearance point of view, it does not matter if there are included or not.

Adding Meta Tags to Your Documents

You can add metadata to your web pages by placing <meta> tags inside the header of the document which is represented by <head> and </head> tags. A meta tag can have following attributes in addition to core attributes:

Attribute Description
Name Name for the property. Can be anything. Examples include, keywords, description, author, revised, generator etc.
content Specifies the property’s value.
scheme Specifies a scheme to interpret the property’s value (as declared in the content attribute).
http-equiv Used for http response message headers. For example http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.

Specifying Keywords

You can use <meta> tag to specify important keywords related to the document and later these keywords are used by the search engines while indexing your webpage for searching purpose.

Sample

In below sample we are adding HTML, Meta Tags, Metadata as important keywords about the document.

 

Document Description

You can use <meta> tag to give a short description about the document. This again can be used by various search engines while indexing your webpage for searching purpose.

Sample

 

Document Refreshing

A <meta> tag can be used to specify a duration after which your web page will keep refreshing automatically.

Sample

To refresh page every 5 seconds then following syntax can be used.

 

Page Redirection

You can use <meta> tag to redirect your page to any other webpage. You can also specify a duration if you want to redirect the page after a certain number of seconds.

Example

Following is an example of redirecting current page to another page after 5 seconds. If you want to redirect page immediately then do not specify content attribute.

Close