HTML <meta> tag represents a metadata and also useful for page rankings in SEO.
The meta tag contains metadata that is invisible for any web page, but most important for search engines like Google, Yahoo, Bing etc to optimize page rankings for web site. It is always used inside HTML <head> tag.
Note: The <meta> tag mostly supported in all major web browsers.
Sample Code
<!– To define content type for web page –>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!– To define description for the web page –>
<meta name="description" content="WebBlogsForYou offers online web blogs" />
<!– To define keywords for the web page –>
<meta name="keywords" content="HTML,CSS,JavaScript,jQuery">
<!– To define author for the web page or article –>
<meta name="author" content="WebBlogsForYou">
<!– To define robot to index,noindex,follow,nofollow the web page –>
<meta name="robot" content="index,follow" />
</head>
Sample Result
Result will not displayed as it defines under head tag. HTML head tag contains invisible tags where as
body tag contains all visible tags for web page
Tag Specific Attributes Support
Following are meta tag attributes that are supported by <meta> tag.
Attribute | Value | Description |
---|---|---|
charset | charset_text | Represents character set for the web page for eg utf-8 |
content | content_text | Represents content for the associated attributes of the meta tag for the web page |
http-equiv | content-type content-style-type default-style expires refresh |
Represents the HTTP header information for the web page |
name | author description keywords |
Represents name of the meta tag for the web page |
Standard Attributes Support
HTML <meta> tag supports mostly all HTML Attributes. Following are some most common attributes that are used by <meta> tag. You can get more details about available HTML Attributes here.
Attribute | Value | Description |
---|---|---|
class | user_defined | Represents a style for an element which is used in CSS style sheet |
id | user_defined | Represents unique id for an element |
style | css_properties | Represents an inline style for an element for e.g style=”color:red;text-decoration:underline;” |
title | user_defined | Represents a tooltip information for an elements like img, a, abbr etc |
Event Attributes Support
HTML <meta> tag does not support Event Attributes. But you can get more details about available HTML Event Attributes here.