<meta>
HTML <meta> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <meta name="description" content="Free Web tutorials"> <meta name="keywords" content="HTML,CSS,XML,JavaScript"> <meta name="author" content="Ståle Refsnes"> <meta charset="UTF-8"> </head> <body> <p>所有 meta 标签显示在 head 部分...</p> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
All major browsers support< meta> tag.
Tag definition and usage instructions
Metadata is the data information of the data. The
<meta> tag provides metadata for an HTML document. The metadata is not displayed on the client side and is parsed by the browser at that time.
The META element is typically used to specify a web page's description, keywords, the file's last modification, author, and other metadata.
Metadata can be called using browsers (how content is displayed or pages are reloaded), search engines (keywords), or other web services.
Tips and Notes
Note: The <meta> tag is usually located in the <head> within the area.
Note: Metadata usually appears in name/value pairs.
Note: If the name attribute is not provided, the name in the name/value pair will take the value of the http-equiv attribute.
Differences between HTML 4.01 and HTML5
HTML5 does not support the scheme attribute.
In HTML5, there is a new charset attribute that makes character set definition easier:
- HTML 4.01: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- HTML5: <meta charset="UTF-8">
Differences between HTML and XHTML
In HTML the <meta> tag does not have a closing tag.
In XHTML the <meta> tag must contain a closing tag.
Example
Example 1 - Define document keywords for search engines:
Example 2 - Define web page description:
Example 3 - Definition page author:
Example 4 - Refresh the page every 30 seconds:
Attribute
New: HTML5 new attribute.
Attributes | Value | Description |
---|---|---|
charsetNew | character_set | Define the character encoding of the document. |
content | text | Defines meta-information related to the http-equiv or name attribute. |
http-equiv | content-type Default-style refresh | Associate the content attribute to the HTTP header. |
name | application-name Author Description Generator keywords | Associate the content attribute to a name. |
scheme | format/URI | HTML5 is not supported. Define the format used to translate content attribute values. |
Event attributes
<p> tag supports all HTML event attributes.
Related Articles
HTML Tutorial: HTML Header