HTML <meta> tag
The <meta> tag describes the metadata of HTML page.
The metadata is information about data. In simple words, it is data about the data
It contains page description, viewport, refresh rate, author of the page, keywords etc.
The user cannot see the <meta> tag but it is important for indexing your HTML document in Google.
If you set up the meta information about your HTML document, it helps the search engine like google to rank your document well.
So, it increases the search visibility of the document and users tend to follow those web pages more compared to those HTML document which does not have meta tags at all.
In HTML, the <meta> tag has no end tag but in XHTML <meta> tag must be closed correctly.
Syntax:
<meta charset=”character-set-type”>
<meta name=”author” content=”author-name”>
<meta name=”keywords” content=”list of comma separated keywords”>
<meta name=”description” content=”Short description of the page”>
<meta name=”viewport” content=”width=device-width”, initial-scale=1″>
Example
<head> <meta charset="UTF-8"> <meta name="author" content="Daniel scott"> <meta name="description" content="Tutorials"> <meta name="keywords" content="Php,SQL,Perl"> </head>
Default CSS Value
NONE
How Browser will display
The browser does not display the content but it stores the information of the data in the browser for Search Engines.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
The format is <meta http-equiv="content-type" content="text/html; charset=UTF-8"> does not have End tag | must include End tag as - <meta .... /> | The format is <meta charset="UTF-8"> |
Attributes used with <meta> tag
Attribute | Description |
---|---|
charset | Charset describes the character encoding of the HTML document. The most preferrd value of character set is UTF-8. The other common value is ISO-8859-1. |
content | Sets the actual content(text) associated with the http-equiv or name attribute. |
http-equiv | Set the HTTP header for the value of the content attribute. This can take a value of content-type, default-style or content-syle. |
name | Describes the name of the metadata element. The name can be author, application-name, description, keywords, viewport or generator, |
scheme | This uses a URI/format to define a scheme to interpret the value of the content attribute. (HTML5 does not support this attribute). |
Global Attributes
The <meta> tag supports Global attributes.
Event Attributes
The <meta> tag supports Event attributes.
Supporting Browsers
Related Tags
<head> tag.