Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML <meta> tags


May 04, 2021 HTML Reference Manual


Table of contents


HTML .lt;meta.gt; tags

Labels are auxiliary tags at the head of the HTML language that provide meta-information about the page (e.g., descriptions and keywords for search engines and update frequency, language used to define the page), and it is beneficial for HTML to use a good label.

Metadata that describes html documents:

<head>
<meta name="description" content="免费web教程">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="W3Cschool">
<meta charset="UTF-8">
</head>

Try it out . . .

Browser support

HTML <meta> tags HTML <meta> tags HTML <meta> tags HTML <meta> tags HTML <meta> tags

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, but is parsed by the browser.

META elements are typically used to specify the description of the page, keywords, the last time the file was modified, 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.

Note: The metadata in the label cannot be represented by other meta-related labels, such as: slt;base,lt;link,","


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">


Property

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 属性值的格式。


The event property

The label supports all HTML event properties.

Online tools

Meta online build tool


Related articles

HTML tutorial: HTML header

CSS3 Learning Notes: Understanding of meta tags