Thursday 9 April 2015

HTML Meta Tags

HTML meta tags are really very important tags.Metadata usually define the additional important information about the documents in many ways. Meta elements used to include name/value pairs describing properties of the HTML document, such as author, keyword, expiry date, author etc.
<meta> : This tag is a empty element so it doesn't have closing tag. It carries information within the attributes.
You can add any no. of meta tags, this is based on your requirements. Meta tags doesn't affect the appearance of the HTML document. The data stored within the meta tag is called metadata.
Meta tag always used within the <head> tag of HTML document. The following attributes can placed in meta tag :

1) Name: Name for the property, can be anything. For example, keywords, description, author, revised, generator etc.

2) content : It specify the property's value.

3) scheme : It specify a scheme to interpret the property's value.

4) http-equiv : It can use to refresh the page or to set the cookie. Values include content-type, expires, refresh, set-cookie.

How to add keywords related to the document : you can use <meta> tag to specify important keywords related to document.Let's see how :

<!DOCTYPE html>
<html>
<head>
<title>Meta Tags Example</title>
<meta name="keywords" content="HTML, Meta Tags, Metadata" />
</head>
<body>
<p>Hello HTML</p>
</body>
</html> 


There are some important examples related to <meta> tags : 
  • If you want to refresh your page in every 10 min the use the following syntax :   <meta http-equiv="refresh" content="10" /> 
  • If you wanna show last date update of your web page then use following syntax  <meta name="revised" content="techtutorialszone, 3/18/2015" />
  • If you wanna add description about web page then use the following syntax :      <meta name="description" content="techtutorialszone is about technology" /> 
  • If you wanna redirect your web page after a certain time then use the following <meta http-equiv="refresh" content="5"  url="http://www.techtutorialszone.blogspot.com" />
  •  If you wanna add cookies storing process within your web page then use it :       <meta http-equiv="cookie" content="userid=xyz; expires=Wednesday, 08-Aug-15 23:59:59 GMT;" />    
NOTE :  If you will not use expires date the cookies will treated as the session cookies, means when you close the browser then cookies will automatically deleted.

THIS IS ALL ABOUT META TAGS, THANK YOU !                                                                                     

No comments:

Post a Comment