HTML <meta> tag is used to represent the metadata about the HTML document. It specifies page description, keywords, copyright, language, author of the documents, etc.
The metadata does not display on the webpage, but it is used by search engines, browsers and other web services which scan the site or webpage to know about the webpage.
With the help of meta tag, you can experiment and preview that how your webpage will render on the browser.
The <meta> tag is placed within the <head> tag, and it can be used more than one times in a document.
Syntax:
<meta charset="utf-8">
Following are some specifications about the HTML <meta> tag
Display | None |
Start tag/End tag | Empty Tag(Only Start tag) |
Usage | Document Structural |
Following are some specific syntaxes of meta tag which shows the different uses of meta Tag.
1. <meta charset="utf-8">
It defines the character encoding. The value of charset is “utf-8” which means it will support to display any language.
2. <meta name="keywords" content="HTML, CSS, JavaScript, Tutorials">
It specifies the list of keyword which is used by search engines.
3. <meta name="description" content="Free Online tutorials">
It defines the website description which is useful to provide relevant search performed by search engines.
4. <meta name="author" content="thisauthor">
It specifies the author of the page. It is useful to extract author information by Content management system automatically.
5. <meta name="refresh" content="50">
It specifies to provide instruction to the browser to automatically refresh the content after every 50sec (or any given time).
6. <meta http-equiv="refresh" content="5; url=https://www.javatpoint.com/html-tags-list">
In the above example we have set a URL with content so it will automatically redirect to the given page after the provided time.
7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
It specifies the viewport to control the page dimension and scaling so that our website looks good on all devices. If this tag is present, it indicates that this page is mobile device supported.
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="HTML, CSS, JavaScript, Tutorials">
<meta name="description" content="Free Online tutorials">
<meta name="author" content="thisauthor">
<meta http-equiv="refresh" content="5; url=https://www.javatpoint.com/html-tags-list">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h2>Example of Meta tag</h2>
<p>This example shows the use of meta tag within an HTML document</p>
</body>
</html>
Attribute:
Tag-specific attributes:
= New in HTML5
Attribute | Value | Description |
---|---|---|
charset | character_set | It specifies the character encoding of an HTML page. |
content | text | It contains the value of the attribute “name” and “http-equiv” in an HTML document, depending on context. |
http-equiv | Content-typedefault-stylerefresh | It specifies the Information given by the web server about how the web page should be served. |
name | application-nameauthordescriptiongeneratorkeywords | It specifies the name of document-level metadata. |
scheme | format/URL | It specifies the scheme in which metadata is described. (Not Supported in HTML5) |
Global attribute:
The <meta> tag supports the global attributes in HTML
Event attribute:
The <meta> tag supports the event attributes in HTML.
Supporting Browsers
Element | Chrome | IE | Firefox | Opera | Safari |
<meta> | Yes | Yes | Yes | Yes | Yes |
Leave a Reply