Description
The <meta>
tag provides structured metadata about the document. The <meta>
element may only appear in the head section of a document, although it may appear any number of times.
The following table summarizes the usages context and the version history of this tag.
Parent: | <head> |
---|---|
Content: | None. It is an empty element. |
Start/ End Tag: | Start tag: required, End tag: forbidden |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
Note: Metadata is data (information) about data – for example, keywords and description that relate to the document.
The <meta>
tag commonly used to provide keywords, descriptions, author information, and other metadata that may be used by the browser to render the document correctly, or it may be used by the search engines for indexing purposes. Here's some real world examples to help you understand <meta>
tag.
Example 1: Define the character encoding for the document <meta charset="UTF-8">
Example 2: Defines the author name of the document
<meta name="author" content="John Smith"> Example 3: Defines a list of keywords for search engines
<meta name="keywords" content="HTML,CSS,Tutorials,References,Examples"> Example 4: Define a brief summery/description of the web page
<meta name="description" content="HTML/CSS Tutorials and References"> Example 5: Enable zooming in mobile devices
<meta name="viewport" content="width=device-width, initial-scale=1">
Syntax
The basic syntax of the <meta>
tag is given with:
HTML:<meta name="text" content="text">
XHTML:<meta name="text" content="text" />
The example below shows the <meta>
tag in action.
<head>
<title>Example of HTML meta tag</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,References,Examples">
</head>
Tag-Specific Attributes
The following table shows the attributes that are specific to the <meta> tag.
Global Attributes
Like all other HTML tags, the <meta>
tag supports the global attributes in HTML5.
Event Attributes
The <meta>
tag also supports the event attributes in HTML5.
Browser Compatibility
Element | |||||
---|---|---|---|---|---|
<meta> | Yes | Yes | Yes | Yes | Yes |
- Installation
- HTML <a> Tag
- HTML <abbr> Tag
- HTML <acronym> Tag
- HTML <address> Tag
- HTML <applet> Tag
- HTML <area> Tag
- HTML <article> Tag
- HTML <aside> Tag
- HTML <audio> Tag
- HTML <base> Tag
- HTML <b> Tag
- HTML <basefont> Tag
- HTML <bdi> Tag
- HTML <bdo> Tag
- HTML <big> Tag
- HTML <blockquote> Tag
- HTML <br> Tag
- HTML <body> Tag
- HTML <center> Tag
- HTML <button> Tag
- HTML <cite> Tag
- HTML <canvas> Tag
- HTML <caption> Tag
- HTML <code> Tag
- HTML <col> Tag
- HTML <dd> Tag
- HTML <colgroup> Tag
- HTML <dfn> Tag
- HTML <del> Tag
- HTML <div> Tag
- HTML <dl> Tag
- HTML <details> Tag
- HTML <dt> Tag
- HTML <em> Tag
- HTML <embed> Tag
- HTML <fieldset> Tag
- HTML <figure> Tag
- HTML <figcaption> Tag
- HTML <font> Tag
- HTML <footer> Tag
- HTML <datalist> Tag
- HTML <frameset> Tag
- HTML <frame> Tag
- HTML5 Global Attributes
- HTML <head> Tag
- HTML <header> Tag
- HTML <hgroup> Tag
- HTML <hr> Tag
- HTML <html> Tag
- HTML <iframe> Tag
- HTML <i> Tag
- HTML <form> Tag
- HTML <input> Tag
- HTML <keygen> Tag
- HTML <legend> Tag
- HTML <ins> Tag
- HTML <kbd> Tag
- HTML <li> Tag
- HTML <link> Tag
- HTML <map> Tag
- HTML <img> Tag
- HTML <mark> Tag
- HTML <menu> Tag
- HTML <meta> Tag
- HTML <meter> Tag
- HTML <nav> Tag
- HTML <noframes> Tag
- HTML <noscript> Tag
- HTML <object> Tag
- HTML <ol> Tag
- HTML <optgroup> Tag
- HTML <option> Tag
- HTML <output> Tag
- HTML <p> Tag
- HTML <param> Tag
- HTML <pre> Tag
- HTML <progress> Tag
- HTML <q> Tag
- HTML <rp> Tag
- HTML <rt> Tag
- HTML <ruby> Tag
- HTML <s> Tag
- HTML <samp> Tag
- HTML <script> Tag
- HTML <section> Tag
- HTML <select> Tag
- HTML <small> Tag
- HTML <source> Tag
- HTML <strike> Tag
- HTML <span> Tag
- HTML <style> Tag
- HTML <strong> Tag
- HTML <sub> Tag
- HTML <summary> Tag
- HTML <sup> Tag
- HTML <table> Tag
- HTML <tbody> Tag
- HTML <td> Tag
- HTML <textarea> Tag
- HTML <th> Tag
- HTML <tfoot> Tag
- HTML <thead> Tag
- HTML <source> Tag
- HTML <tr> Tag
- HTML <tt> Tag
- HTML <title> Tag
- HTML <u> Tag
- HTML <ul> Tag
- HTML <var> Tag
- HTML <video> Tag
- HTML <wbr> Tag
- HTML <dir> Tag