HTML meta tag and element
1. HTML meta element contains information about an HTML document.
2. The information contained by meta element can not be presented by using any other meta elements (base, link, meta, script, style, and title.)
Syntax
<meta attrbiute="value" >
Category
HTML meta element is part of the global structure of an HTML page.
Whether both start and end tags are required
Start tag is required, end tag is not.
Can contain
HTML meta element can not contain any other element.
Can reside within
HTML meta element can reside within head element only.
Attributes
Attributes specific to this element
name: This attribute specifies a name which provides information for the entire document. The value of this attribute is relevant to the value of the content. If this attribute is set, same meta element can not contain http-equiv attribute.
The following table provides a list of the values.
Values | Description |
---|---|
application-name | Defines the name of the web application running in the webdocument. |
author | Defines the name of the author of the document. |
description | Specifies a short but appropriate summary of the content of the webdocument. Several browsers and search engines use this meta as the consider this as the default description of the page. |
generator | Contains the identifier to the software that generated the webdocument. |
keywords | Contain a comma separated list of words relevant to the content of the webdocument. |
Example of using name attribute in meta element
The name attribute may also have extended values taken. Two of those values are described bellow.
Values | Description |
---|---|
expires | Defines the expiration date of the webdocument |
robot | Specifies a comma-separated list of operators defining how crawlers (of search engines) should see the content |
If robot is set as the value of the name attribute, the value of the content attribute may be one of the following.
Values | Description | Which Search Engine use it |
---|---|---|
index | Allows the robot to index the webdocument. | All |
noindex | Prohibits the robot to index the page. | All |
follow | Allows the robot to follow the links of the webdocument. | All |
nofollow | Prohibits the robot from following the links of the webdocument. | All |
noodp | Prevents the usage of the Open Directory Project description, if used, as the description of the page in the search engine results page. | Google, Yahoo, Bing |
noarchive | Prohibits the search engine from caching the content of the webdocument. | Google, Yahoo |
nosnippet | If used, search engines will not display the description of the page in search engine result page. | |
noimageindex | If used. the webdocument is not used as a reference to any image indexed by search engines. | |
noydir | Prevents the usage of the Yahoo Directory description, if used, as the description of the page in the search engine results page. | Yahoo |
nocache | Same as noarchive. | Bing |
Example of using expires name attribute in meta element
<meta name="expires" content="1 January 2020 ">
Example of using robot name attribute in meta element to set a page nofollow
<meta name="robot" content="nofollow">
content: Value of this attribute contains the values for the attribute set in the name property.
scheme: Specifies a scheme which can be used to represent the value of the content attribute.
Example of using scheme attribute in meta element
<meta scheme="ISBN" content="81-265-0521-4">
http-equiv: Provides an HTTP header for the information in the content attribute.
Example of using http-equiv attribute in meta element
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
Identifiers
Does not support.
Language information and text direction
Title
Does not support.
Style
Does not support.
Events
HTML html element does not support event attributes.
Previous: HTML title tag and element
Next:
HTML body tag and element
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/meta/HTML-meta-tag-and-element.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics