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
<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.
<meta> tag is always used inside
<head> tag in an HTML Document.
<meta> Tag Syntax and Usage
<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.
This attribute is used to declare the web page's character encoding.
Its value is character_set
application_name:- defines the name of application running the web page.
author:- which is used to define the name of the author.
keywords:- which contain words relevant to the content of the web page separated using commas
referrer:- controls the HTTP referrer header which is attached to the request that has been sent from the browser
generator:- it contains the identifier of the software that generated the page.
description:- contains a short and accurate summary of the content of the Web Page.
||It contains the value of name or http-equiv attribute depending on which is used.
This attribute is used to provide an http-header for the information of the content attribute.
This attribute's instructions are as given follows:-
content-security-policy:-allows page author to define a content-policy
refresh:- The number of seconds until the page should be reloaded only if the content attribute contains a positive integer.
set-cookie:- defines a cookie for the page
HTML <meta> Tag Basic Example
Below we have a basic example of the <meta> tag:
<!-- 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:
Google Chrome 1+
Internet Explorer 2+