Posts in current category

HTML5 <meta> tag

May 03, 2021 16:00 HTML5

Table of contents


Metadata that describes html documents:

<meta name="description" content="免费在线教程">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="w3cschool">
<meta charset="UTF-8">
Try it out . . .

Browser support

HTML5 <meta> tag HTML5 <meta> tag HTML5 <meta> tag HTML5 <meta> tag HTML5 <meta> tag

All major browsers support the hashtag.

Label definition and instructions for use

Metadata is the data information for the data.

The label provides metadata for the HTML document. Metadata is not displayed on the client and is then parsed by the browser.

META elements are typically used to specify the description of the page, keywords, the last modification of the file, the author, and other metadata.

Metadata can be called using a browser (how to display content or reload pages), search engines (keywords), or other Web services.

Tips and comments

Note: The label is usually located in the area of the slt;head.

Note: Metadata usually appears as a name/value pair.

Note: If the name property is not provided, the name in the name/value pair takes the value of the http-equiv property.

The difference between HTML 4.01 and HTML5

HTML5 does not support the scheme property.

In HTML5, there is a new charset property that makes the definition of character sets easier:

  • HTML 4.01:<meta http-equiv="content-type" content="text/html; charset=UTF-8">
  • HTML5:<meta charset="UTF-8">

The difference between HTML and XHTML

In HTML, the label does not end the label.

In XHTML, the label must contain an end label.


Example 1 - Define document keywords for search engines:

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

Instance 2 - Define the description of the web page:

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

Instance 3 - Define page author:

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

Instance 4 - Refresh the page every 30 seconds:

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


New: HTML5 new property.

Property Value Describe
charset New character_set Define the character encoding of the document.
content text Define meta-information related to the http-equiv or name properties.
http-equiv content-type
Associate the content property to the HTTP header.
name application-name
Associate the content property to a name.
scheme format/URI HTML5 is not supported. Define the format used to translate the content property value.

The event property

The label supports all HTML event properties.

Related articles

HTML tutorial: HTML header