html
  1. html-meta-tag

HTML <meta> Tag

  • The <meta> tag is an HTML tag that provides metadata about an HTML document.
  • It is generally placed in the <head> section of an HTML document.
  • Metadata provided by the <meta> tag is not displayed on the page and is used mainly by search engines and browsers.

Syntax

The syntax for the <meta> tag is as follows:

<meta name="name" content="content">

Example

Here is an example of the <meta> tag:

<!DOCTYPE html>
<html>
  <head>
    <meta name="description" content="This is a sample page for the meta tag.">
    <meta name="keywords" content="HTML, meta tag, sample">
    <title>Meta Tag Sample Page</title>
  </head>
  <body>
    <h1>Welcome to my meta tag sample page!</h1>
    <p>This is a sample page for the meta tag. It demonstrates the use of the meta tag for providing metadata about the page.</p>
  </body>
</html>
Try Playground

The output of the above example will be an HTML page with the title "Meta Tag Sample Page". The metadata provided by the <meta> tags will not be visible on the page.

Explanation

The <meta> tag has two attributes: name and content. The name attribute specifies the type of metadata being provided, while the content attribute specifies the value of the metadata.

In the example above, the first <meta> tag provides a description of the page, while the second <meta> tag provides keywords that are relevant to the page.

Use

The <meta> tag is commonly used to provide metadata about a webpage. Some common uses of the <meta> tag include providing a description of the page, specifying keywords relevant to the page, disabling caching of the webpage, and specifying the character encoding of the page.

Important Points

  • The <meta> tag is usually placed in the <head> section of an HTML document.
  • The name attribute specifies the type of metadata being provided, while the content attribute specifies the value of the metadata.
  • The metadata provided by the <meta> tag is used mainly by search engines and browsers and is not displayed on the page.
  • The <meta> tag is commonly used to provide a description of the page, specify keywords relevant to the page, disable caching of the webpage, and specify the character encoding of the page.

Summary

The <meta> tag is an HTML tag used to provide metadata about an HTML document. It is placed in the <head> section of an HTML document and is used mainly by search engines and browsers. The tag has two attributes: name and content, which specify the type and value of the metadata respectively. Some common uses of the <meta> tag include providing a description of the page, specifying keywords relevant to the page, disabling caching of the webpage, and specifying the character encoding of the page.

Published on: