Using <meta> tag in HTML5

<Meta> tag is used to describe more details about web page. Using <meta> tag we can specify description, author, keywords etc. Search engines are usually use this details.

Description
When you search something in search engine you may notice that each link contains 2-3 line description about webpage. This description is specified by below snippet.

<meta name="description" content="Long desc for page." />

Keywords
Keywords are helpful for improving search-ability of webpage. Each keywords are separated by commas.

<meta name="keywords" content="List, of, keywords" />

Author
We can also store author name using <meta> tag.

<meta name="author" content="Nilay Mehta" />

Revision Date
We can also specify revision date of page using <meta> tag. This revision date is used by many browsers for handling caching of web page.

<meta name="revised" content="Author name, 10/8/2015" />

Content Type
For specifying content type we need to use http-equiv attribute of <meta> tag. We can also set content type and charset in single statement.

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

Charset
In HTML5 we can set charset by using charset attribute previously we need to use with content-type as above snippet.

<meta charset="UTF-8">

Refresh
If you want to refresh your page after some seconds then you can use http-equiv attribute of <meta> tag. Note that the value specified in terms of seconds not milliseconds.

<meta http-equiv="refresh" content="5" />

Redirect
We can also redirect user to some different page, for this we need to specify URL of destination and seconds after which page will be redirect. If you want to redirect immediately then specify 0 seconds.

<meta http-equiv="refresh" content="5; url=http://www.mydomain.com" />

2 thoughts on “Using <meta> tag in HTML5

Leave a Reply

Your email address will not be published. Required fields are marked *