Latest web development tutorials

HTML <meta> tag

Examples

Metadata that describes the HTML document:

<head>
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="Stale Refsnes">
<meta charset="UTF-8">
</head>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the <meta> tag.


Tag definitions and instructions

Metadata (Metadata) data is information data.

<Meta> tag provides metadata HTML document. Metadata is not displayed in the client, then the browser will be resolved.

Last Review META element often used to describe a given page, keyword, file, authors, and other metadata.

Metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other Web service calls.


Tips and Notes

Note: <meta> tag is generally placed in the <head> area.

Note: Metadata is usually name / value pairs appear.

NOTE: If no name attribute, then the name / value pairs in the name takes the value 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, which makes it easier to define the character set:

  • 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 <meta> tag has no end tag.

In XHTML <meta> tag must have a closing tag.


Examples

Example 1 - Define the document keywords for search engines:

<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">

Example 2 - Define web page description:

<meta name="description" content="Free Web tutorials on HTML and CSS">

Example 3 - Define page author:

<meta name="author" content="Hege Refsnes">

Examples 4 - refresh the page every 30 seconds:

<meta http-equiv="refresh" content="30">


Attributes

New: HTML5 new property.

属性 描述
charset New character_set 定义文档的字符编码。
content text 定义与 http-equiv 或 name 属性相关的元信息。
http-equiv content-type
default-style
refresh
把 content 属性关联到 HTTP 头部。
name application-name
author
description
generator
keywords
把 content 属性关联到一个名称。
scheme format/URI HTML5不支持。 定义用于翻译 content 属性值的格式。


Event Properties

<p> tag supports all HTML event attributes .


related articles

HTML Tutorial: HTML head