[Web] In the front-end, HTML <meta> tag

<meta>Instance

<head>
    <meta name="description" content="免费在线教程">
    <meta name="keywords" content="HTML,CSS,XML,JAVASCRIPT">
    <meta name="author" content="runoob">
    <meta charset="UTF-8">
</head>

Label definition and usage instructions

All current mainstream browsers basically support the <meta> tag.

The <meta> tag provides metadata for an HTML document . The metadata will not be displayed on the client , but will be parsed by the browser .

In other words, this meta is for browsers, but users can retrieve this web page with the help of the information set by programmers in meta.

META is usually used to specify the description of the web page, keywords, the last modification time of the file, the author and other metadata.

Metadata can be used by browsers (how to display content or reload the page), search engines (keywords), or other web services.

Small knowledge points to pay attention to

  • The <meta> tag is usually located within the <head> area.
  • Metadata usually appears as name and value pairs.
  • If the name attribute is not provided, the name in the name, value pair will use the value of the http-equiv attribute.

Differences between HTML4.01 and HTML5

HTML5 does not support the scheme attribute.

In HTML5, there is a new charset (charset n. character set) attribute, which makes character set definition easier. For example:

<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta charset="UTF-8">

equivalent n.value

charset n. character set

UTF-8: (8-bit, Universal Character Set/Unicode Transformation Format) is a variable-length character encoding for Unicode. It can represent any character in the Unicode standard, and the first character in the encoding is still compatible with the ASCII code, so that the original software that processes ASCII characters can continue to be used without or with only a few modifications. Therefore, it has gradually become the preferred encoding in emails, web pages, and other applications that store or transmit text. There are three encoding methods of Unicode: UTF-8, UTF-16, and UTF-32. Since UTF-8 has nothing to do with byte order (no need for BOM) and is compatible with ASCII encoding, UTF-8 encoding has become a widely used Internet information encoding standard today.

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.

Summary of <meta> attributes

Detailed explanation of <meta> examples

Example 1: keywords

keywords: Define document keywords for search engines. 

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

Example 2: description

description: Define web page description 

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

Example 3: author

name: defines the page author

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

Example 4: refresh

refresh: Refresh the page every 30 seconds

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

New HTML5 attribute for <meta>

Guess you like

Origin blog.csdn.net/2301_78131481/article/details/134249977