Loading...
HTML Meta Tag

HTML Meta Tag

In this tutorial, we will learn about meta tag in HTML with the help of examples.


<meta> Tag

The <meta> Element is used to define metadata about an HTML document. It provides important information about a document.
A web document can include one or more <meta> tag but in general, meta tags don’t affect the physical appearance of the document. It carries information within its attributes.

Things to Remember :

  • The <meta> tag always go inside the <head> element.
  • <meta> tag is an empty element because it only has an opening tag.
  • Metadata is used by browsers, search engines, and other web services.
  • Add a meta tag to HTML Document – add metadata in HTML document using meta tag inside the head tag.

Attributes used in <meta> Tag

Attributes Value Description
Name name, author, description, keywords, viewport Used to define the name of the metadata
charset character_set specify the character encoding for the HTML document
http-equiv content-security-policy, content-type, default-style, refresh specify the HTTP responsive header
content text specify the properties value

Meta Tag Basic Attributes

  • keywords - Define important keywords for search engines
  • character_set - Define the character encoding for the HTML document
  • Description - Define short description about the document for search engines
  • Refresh - Specify a duration after which your webpage will refresh automatically
  • Viewport - Setting the viewport to make website look good on all devices
  • Author name - Setting author name in a webpage

Example :

<!DOCTYPE html>
<html>
  <head>
    <title>HTML meta tag</title>
    <meta name = "keywords" content = "HTML, CSS, JS">
    <meta character_set = "UTF-8">
    <meta name = "description" content = "Learn HTML, C language and C++ Language for free">
    <meta http-equiv = "refresh" content = "15s">
    <meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
    <meta name = "author" content = "xyz">
  </head>
  <body>
    Here, we use meta tags.
  </body>
</html>

Output

Here, we use meta tags.

Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of Meta tags in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML Quotations Tag.

- Related Topics