About the role of meta in HTML (collected and sorted from the Internet)

About the role of meta in HTML (collected and sorted from the Internet)
W3Cschool explains it this way

The <meta> element provides meta-information about the page, such as a description and keywords for search engines and update frequency.

The <meta> tag is placed in the head of the document and contains no content. The attributes of the <meta> tag define name/value pairs associated with the document.

Differences between HTML and XHTML

In HTML, the <meta> tag has no closing tag.

In XHTML, <meta> tags must be properly closed.

Tips and Notes:

Note: The <meta> tag is always placed inside the head element.

Note: Metadata is always passed in name/value pairs.

name attribute

The name attribute provides the name of the name/value pair. Neither HTML nor XHTML tags specify any predefined <meta> names. In general, you are free to use names that are meaningful to you and to readers of your source document.

"Keywords" is a name that is often used. It defines a set of keywords for the document. Some search engines use these keywords to categorize documents when they encounter them.

Meta tags like this may help with search engine indexing:

http-equiv attribute

The http-equiv attribute provides a name for the name/value pair. It instructs the server to include the name/value pairs in the header of the MIME document that is sent to the browser before sending the actual document.

When a server sends a document to a browser, it first sends a number of name/value pairs. Although some servers send many of these name/value pairs, all servers send at least one: content-type: text/html. This tells the browser to prepare to receive an HTML document.

When you use the <meta> tag with the http-equiv attribute, the server will add the name/value pair to the content header that is sent to the browser.

The content property

The content attribute provides the value in a name/value pair. The value can be any valid string.

The content attribute is always used with either the name attribute or the http-equiv attribute.

The scheme attribute

The scheme attribute is used to specify the scheme to be used to translate the attribute value. This scheme should be defined in the profile specified by the profile attribute of the <head> tag.

meta is used to simulate the HTTP protocol response header message in HTML documents. The meta tag is used in the <head> and </head> of a web page. The meta tag has many uses. There are two meta attributes: name and http-equiv. The name attribute is mainly used to describe the web page, corresponding to the content (web page content), to facilitate search engine robots to find and classify (currently almost all search engines use online robots to automatically find meta values ​​to classify web pages). The most important of these are description (description of the site on search engines) and keywords (category keywords), so a meta value should be added to each page. The more commonly used ones are the following:

name attribute

1. <meta name="Generator" context="">is used to describe the generation tool (such as Microsoft FrontPage 4.0);

2. <meta name="KEYWords" contect="">Inform search engines of the keywords of your web page;

3. <meta name="DEscription" contect="">Tell search engines the main content of your site;

4. <meta name="Author" contect="your name"> Tell search engines the author of your site;

5. <meta name="Robots" context="all|none|index|noindex|follow|nofollow">

The properties are described as follows:

Set to all: files will be retrieved and links on the page can be queried;

Set to none: the file will not be retrieved and the links on the page cannot be queried;

Set to index: the file will be retrieved;

Set to follow: links on the page can be queried;

Set to noindex: the file will not be indexed, but the links on the page can be queried;

Set to nofollow: The file will not be indexed, but the links on the page can be queried.

http-equiv attribute

1. <meta http-equiv="Content-Type" contect="text/html";charset=gb_2312-80">

and <meta http-equiv="Content-Language" contect="zh-CN">to describe the text and language used to create the homepage;

For example, English is ISO-8859-1 character set, and there are also BIG5, utf-8, shift-Jis, Euc, Koi8-2 and other character sets;

2. <meta http-equiv="Refresh" contect="n;url=http://yourlink">Schedule the web page to jump to the page http://yourlink within the specified time n;

3. <meta http-equiv="Expires" contect="Mon,12 May 2001 00:20:00 GMT"> can be used to set the expiration time of the web page. Once it expires, it must be called again on the server. It should be noted that the GMT time format must be used;

4. <meta http-equiv="Pragma" contect="no-cache"> is used to prohibit the browser from accessing the page content from the local machine's cache. Once it is set, once you leave the web page, it cannot be retrieved from the cache;

5. <meta http-equiv="set-cookie" contect="Mon,12 May 2001 00:20:00 GMT">Cookie settings. If the web page expires, the saved cookies will be deleted. It should be noted that the GMT time format must be used;

6. <meta http-equiv="Pics-label" context="">Web page rating. There is a content setting in IE's internet options that can prevent browsing of some restricted websites. The restriction level of the website is set through the meta attribute;

7. <meta http-equiv="windows-Target" contect="_top">Force the page to be displayed as an independent page in the current window, which can prevent your web page from being called as a frame page by others;

8. <meta http-equiv="Page-Enter" contect="revealTrans(duration=10,transtion= 50)"> and <meta http-equiv="Page-Exit" contect="revealTrans(duration=20,transtion=6)"> set special effects when entering and leaving the page. This function is the "Format/Web Page Transition" in FrontPage, but the added page cannot be a frame page.

<<:  Detailed process of modifying hostname after Docker creates a container

>>:  CSS eight eye-catching HOVER effect sample code

Recommend

HTML uses marquee to achieve text scrolling left and right

Copy code The code is as follows: <BODY> //...

Sample code for implementing mysql master-slave replication in docker

Table of contents 1. Overview 1. Principle 2. Imp...

Summary of the characteristics of SQL mode in MySQL

Preface The SQL mode affects the SQL syntax that ...

How to safely shut down MySQL

When shutting down the MySQL server, various prob...

A brief discussion on value transfer between Vue components (including Vuex)

Table of contents From father to son: Son to Fath...

How to Completely Clean Your Docker Data

Table of contents Prune regularly Mirror Eviction...

Manually implement js SMS verification code input box

Preface This article records a common SMS verific...

How to use the realip module in Nginx basic learning

Preface There are two types of nginx modules, off...

How to build a DHCP server in Linux

Table of contents 1. Basic knowledge: 2. DHCP ser...

Solution to MySQL remote connection failure

I have encountered the problem that MySQL can con...

Implementation of crawler Scrapy image created by dockerfile based on alpine

1. Download the alpine image [root@DockerBrian ~]...

IIS 7.5 uses URL Rewrite module to achieve web page redirection

We all know that Apache can easily set rewrites f...

Detailed tutorial on installing MySQL database on Alibaba Cloud Server

Table of contents Preface 1. Uninstall MySQL 2. I...

Navicat Premium operates MySQL database (executes sql statements)

1. Introduction to Navicat 1. What is Navicat? Na...