Signup/Sign In
PUBLISHED ON: FEBRUARY 19, 2021

HTML Meta Tag

In HTML, the <meta> tag is used to represent metadata.

  • This meta-data represented by <meta> tag cannot be represented using other HTML tags like <base>,<link>,<script>,<style> and <title>

  • The <meta> tag comes under the category of Empty elements.

  • Metadata will not be displayed on the web page and metadata is used by browsers and search engines.

  • Metadata is simply data about data or it is information about the data.

  • The <meta> tag is always used inside <head> tag in an HTML Document.

HTML <meta> Tag Syntax and Usage

As <meta> is an empty tag, it does not require an end tag it only requires a start tag.

The basic syntax for the same is given below:

<meta charset=" ">

HTML <meta> Tag Attributes

The <meta> tag supports both global and event attributes and some of the common attributes are given below.

Attributes Description
charset

This attribute is used to declare the web page's character encoding.

Its value is character_set

name
  • This attribute is used to define the name of metadata.

  • The values of the name attribute are as follows:-

  1. application_name:- defines the name of application running the web page.

  2. author:- which is used to define the name of the author.

  3. keywords:- which contain words relevant to the content of the web page separated using commas

  4. referrer:- controls the HTTP referrer header which is attached to the request that has been sent from the browser

  5. generator:- it contains the identifier of the software that generated the page.

  6. description:- contains a short and accurate summary of the content of the Web Page.

content It contains the value of name or http-equiv attribute depending on which is used.
http-equiv

This attribute is used to provide an http-header for the information of the content attribute.

This attribute's instructions are as given follows:-

  1. content-security-policy:-allows page author to define a content-policy

  2. refresh:- The number of seconds until the page should be reloaded only if the content attribute contains a positive integer.

  3. set-cookie:- defines a cookie for the page

HTML <meta> Tag Basic Example

Below we have a basic example of the <meta> tag:

<meta charset="utf-8">

<!-- Redirect page after 3 seconds -->
<meta http-equiv="refresh" content="3;url="https://www.studytonight.com/">

Syntax to define Keyword for Search Engine

<meta name="keywords" content="Java,python,jQuery">

Syntax to define the author of the Page

<meta name="author" content="Himani">

Syntax to refresh the document

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

// it will refresh document after every 10 seconds

Browser Support for HTML5 <meta> tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 2+

  • Safari 1+

  • Opera 4+



About the author:
Aspiring Software developer working as a content writer. I like computer related subjects like Computer Networks, Operating system, CAO, Database, and I am also learning Python.