HTML | <Meta> Tag

The metadata means the information about data. The <meta> tag in HTML provides information about HTML Document or in simple words, it provides important information about a document. These tags are basically used to add name/value pairs to describe properties of HTML document, such as expiry date, author name, list of keywords, document author etc. This tag is an empty element because it only have an opening tag and no closing tag but it carries information within its attributes. A web document can include one or more meta tag depending on information, but in general, it doesn’t affect physical appearance of the document.

  • Add Meta tag to HTML Document: Add metadata in HTML document is the adding information about data in HTML document using meta tag inside head tag.
  • Name attribute: This attribute is used to define the name of property.
  • http-equiv attribute: This attribute is used to get http response message header.
  • Scheme attribute: This attribute is used to specify a scheme to interpret the property’s value.
  • Content attribute: This attribute is used to specify properties value.

Specifying Keywords: The meta tag is used to specify the important keyword related to the HTML document.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Hello GeeksforGeeks!

Document Description: This meta tag is used in HTML document to provide short description about the document.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Meta Tags example</title>
        <meta name = "keywords" content = "Meta Tags, Metadata" />
        <meta name = "description" content = "Geeksforgeeks is a 
                                     computer science portal." />
    </head>
          
    <body>
        <p>GeeksforGeeks!</p>
    </body>
</html>                    

chevron_right


Output:



GeeksforGeeks!

Document Revision Date: This meta tag is used to give the information about last updated document. This information is used by various web browser when refresh web page.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Meta tags example</title>
        <meta name = "keywords" content = "Meta Tags, Metadata" />
        <meta name = "description" content = "Learn about Meta Tags." />
        <meta name = "revised detail" content = "last updated time" />
    </head>
          
    <body>
        <p>GeeksforGeeks!</p>
    </body>
</html>                    

chevron_right


Output:

GeeksforGeeks!

Document Refreshing: This 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 8 sec is given below:
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Meta tags example</title>
        <meta name = "keywords about" content = "Meta Tags, Metadata" />
        <meta name = "description" content = "Learning about Meta Tags." />
        <meta name = "revised about" content = "GeeksforGeeks" />
        <meta http-equiv = "refresh" content = "8" />
    </head>
          
    <body>
        <p>GeeksforGeeks!</p>
    </body>
</html>                    

chevron_right


Output:

GeeksforGeeks!

Setting Author Name: The name of the author can be set in web page through HTML document using meta tag.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Meta tags example</title>
        <meta name = "keywords used " content = "Meta Tags, Metadata" />
        <meta name = "description about" content = "Meta tags learning." />
        <meta name = "author" content = "Akash Kumar17" />
    </head>
          
    <body>
        <p>GeeksforGeeks!</p>
    </body>
</html>                    

chevron_right


Output:

GeeksforGeeks!

Browser Supports: The browsers which support meta tags are:

  • Google chrome
  • Internet Explorer
  • Mozilla
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.