Meta Tag in HTML5

Meta Tag

 
The <meta> tag specifies metadata for the document. The Metadata will not be displayed on the page but will be machine parsable. The HTML <meta>tag is for declaring metadata for the HTML document. Metadata can include description, keyword, author, etc. It is also used to refresh the page. The meta tag is placed between opening and closing <head> tags.
 
Metadata is data (information) about data. The <meta> tag can be used by the browsers, search engines or other web services. It provides the information for search engines of your page such as description, refreshes, keyword, etc. The <meta> tag always goes inside the <head> tag. Metadata is always ed as name/value pairs. The Content attribute must be defined if the name or the http-equiv attribute is defined. If none of these are defined then the content attribute cannot be defined.
 
HTML5 has a new attribute charset, that makes it easier to define the charset.
 
Syntax
 
The syntax of the <meta> tag is:
 
<meta name="value" content="value" http-equiv="value" charset="value"/>
 
Browser Support
 
The <meta> tag is supported in all major browsers.
 
Attributes of Meta Tag
 
The <meta> tag has four attributes; they are:
  • name="value"
          the name attribute has the following values:
          application name: This value represents the name of the web application.
          author: The value is a string and must specify the name of the author of the page.
          description: The value specifies the description of the web page.
          generator: The value specifies the name of the software package used.
          keyword: These represent the keywords of the page.
  • http-equiv="value"
          This attribute has the following values:
          refresh: To set the refresh time of the web page.
          default-style: To provide the style sheet set.
          content-language: the language of the document.
  • content="value"
          It specifies the metadata of the document.
  • charset="value"
          It specifies the character encoding used in the document.
 
Example of the <meta> tag in HTML5
  1. <!DOCTYPE html>  
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">  
  3.    <head>  
  4.       <title>Meta Tag in HTML5</title>  
  5.       <meta name="description" content="Html5 article"/>  
  6.       <meta name="keywords" content="c#,html5,asp.net,meta tag"/>  
  7.       <meta name="generator" content="Frontpage"/>  
  8.       <meta name="description" content="Html5 article"/>  
  9.       <meta name="author" content="Ashwani Tyagi"/>  
  10.       <meta name="description" content="Html5 article"/>  
  11.       <meta http-equiv="refresh" content="5;url=http://www.gmail.com/"/>  
  12.       <meta charset="UTF-8"/>  
  13.    </head>  
  14.    <body>  
  15.       <p>It is used to Specify the metadata of the document.</p>  
  16.    </body>  
  17. </html> 
Output
meta.jpg
 
Page redirected to Gmail page
 
meta-tag.jpg