Meta Tag


<meta> tag is used to add a description of HTML page. The description that we add about the web page using the <meta> is used by search engines for indexing and ranking the web page.
<meta> tags always go inside the <head> element.
Meta Data includes Document Title, Keywords, Description, Author Information, Last Modified Date etc. Apart from this, you can describe hundreds of types of Meta Data about an HTML Document.

Importance of Meta Tag


1. Document Title, Content Description (Summary), Keywords, etc. are defined by Meta Tag.
2. Robots can be used to indicate content that you want a "noindex" or "nofollow".
3. The viewport (screen visible to the readers) setting is defined by Meta Tag.
4. Meta Data is also required for SEO - Search Engine Optimization.


Meta Tag Attribute 


1. charset  : Specifies the character encoding for the HTML document.

2. content   : Gives the value associated with the http-equiv or name attribute.

3. http-equiv  : Provides an HTTP header for the information & value of the content attribute.

4. name   : Name attribute used for Specifies a name for the metadata.

Examples :


Description Meta Tag


Define a description of your web page.

Example :


 <!DOCTYPE HTML>


<html>


<head>


<title>www.tutorialsug.com </title>


<meta name="description" content="A website about programming language">


</head>


<body>


</body>




</html>





Keyword Meta Tag


Meta Keyword are used to specify the important keyword is related to the HTML document.

Example :


 <!DOCTYPE HTML>


<html>


<head>


<title>www.tutorialsug.com </title>


<meta name="keywords" content="HTML, SQL, CSS">


</head>


<body>


</body>




</html>


Viewport Meta Tag


Viewport is used to design responsive website / blog .

Example :


 <!DOCTYPE HTML>


<html>


<head>


<title>www.tutorialsug.com </title>


<meta name="viewport" content="width=device-width,intial-scale=1.0">


</head>


<body>


</body>




</html>




Document Refreshing


Meta tag is used to specify a duration after which the web page will keep refreshing automatically after the given duration. The code to refresh web page after 5 sec is given below:

Example:


 <!DOCTYPE HTML>


<html>


<head>


<title>www.tutorialsug.com </title>


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


</head>


<body>


</body>




</html>