How to use meta tags? How to use meta tags

云罗郡主
Release: 2018-10-18 16:40:11
forward
2841 people have browsed it

What this article brings to you is how to use meta tags? The method of using meta tags has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Composition of meta tag: meta tag has two attributes, they are http-equiv attribute and name attribute. Different attributes have different parameter values. These different parameter values ​​are implemented Different web page features.

1. name attribute

The name attribute is mainly used to describe web pages, and the corresponding attribute value is content. The content in content is mainly used by search engine robots to find information and classify information. .

The syntax format of the name attribute of the meta tag is:

<meta name="参数" content="具体的参数值">
Copy after login

The name attribute mainly has the following parameters:

①Keywords(Keywords) 

Description: keywords are used to tell search engines what the keywords of your web page are.

Example:

<meta name="keywords" content="meta总结,html meta,meta属性,meta跳转">
Copy after login

②description (website content description)

Description: description is used to tell search engines the main content of your website.

Example:

<meta name="description" content="haorooms博客,html的meta总结,meta是html语言head区的一个辅助性标签。">
Copy after login

③robots (robot guide)

Description: robots are used to tell the search robot which pages need to be indexed and which pages do not need to be indexed . The parameters of

content include all, none, index, noindex, follow, and nofollow. The default is all.

Example:

<meta name="robots" content="none">
Copy after login

The specific parameters are as follows:
The information parameter is all: the file will be retrieved, and the links on the page can be queried;

The information parameter is none: The file will not be retrieved, and the links on the page cannot be queried;

The information parameter is index: the file will be retrieved;

The information parameter is follow: The links on the page can be Be queried;

The information parameter is noindex: the file will not be retrieved, but the links on the page can be queried;

The information parameter is nofollow: the file will be retrieved, but the links on the page Cannot be queried;

④author(author)

Description: Mark the author of the web page

Example:

<meta name="author" content="root,root@xxxx.com">
Copy after login

⑤generator

<meta name="generator" content="信息参数"/>
Copy after login

The information parameters of the generator in the meta tag represent the software used to create the website.

⑥copyright

<meta name="copyright" content="信息参数">
Copy after login

The COPYRIGHT information parameter of the meta tag represents the copyright information of the website.

⑦revisit-after

<meta name="revisit-after" content="7days">
Copy after login

revisit-after represents website revisit, 7days represents 7 days, and so on.

2.http-equiv attribute

http-equiv, as the name suggests, is equivalent to the file header function of http. It can return some useful information to the browser to help display it correctly and accurately. Web page content, the corresponding attribute value is content, and the content in content is actually the variable value of each parameter.

The http-equiv attribute syntax format of the meta tag is:

<meta http-equiv="参数"content="参数变量值">;
Copy after login

The http-equiv attribute mainly has the following parameters:

①Expires(period)

Description: Can be used to set the expiration time of the web page. Once a web page expires, it must be retransmitted to the server.

Usage:

<meta http-equiv="expires" content="Fri,12Jan200118:18:18GMT">
Copy after login

Note: GMT time format must be used.

②Pragma (cache mode)

Description: Prohibit the browser from accessing page content from the cache of the local computer.

Usage:

<meta http-equiv="Pragma"content="no-cache">
Copy after login

Note: With this setting, visitors will not be able to browse offline.

③Refresh(refresh)

Description: Automatically refresh and point to the new page.

Usage:

<meta http-equiv="Refresh" content="2;URL=http://www.haorooms.com">//
(注意后面的引号,分别在秒数的前面和网址的后面)
Copy after login

Note: The 2 refers to automatically refreshing to the URL after staying for 2 seconds.

④Set-Cookie (cookie setting)

Note: If the web page expires, the saved cookies will be deleted.

Usage:

<meta http-equiv="Set-Cookie"content="cookie value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/">
Copy after login

Note: GMT time format must be used.

⑤Window-target (display window setting)

Description: Force the page to be displayed as an independent page in the current window.

Usage:

<meta http-equiv="Window-target"content="_top">
Copy after login

Note: Used to prevent others from calling your own page in the frame.

⑥content-Type (display character set setting)

Description: Set the character set used by the page.

Usage:

<meta http-equiv="content-Type"content="text/html;charset=gb2312">
Copy after login

The details are as follows:
When the charset information parameter of the meta tag is such as GB2312, it means that the encoding used by the website is Simplified Chinese;

meta When the charset information parameter of the tag is such as BIG5, it means that the encoding used by the website is Traditional Chinese; when the charset information parameter of the

meta tag is such as iso-2022-jp, it means that the encoding used by the website is Traditional Chinese Japanese; when the charset information parameter of the

meta tag is such as ks_c_5601, it means that the encoding used by the website is Korean; when the charset information parameter of the

meta tag is such as ISO-8859-1, It means that the encoding used by the website is English; when the information parameter of the charset of the

meta tag is such as UTF-8, it represents the world's universal language encoding;

⑦content-Language (display Language settings)

Usage:

<meta http-equiv="Content-Language"content="zh-cn"/>
Copy after login

⑧Cache-Control specifies the caching mechanism followed by requests and responses.

Cache-Control指定请求和响应遵循的缓存机制。在请求消息或响应消息中设置Cache-Control并不会修改另一个消息处理过程中的缓存处理过程。请求时的缓存指令包括no-cache、no-store、max-age、max-stale、min-fresh、only-if-cached,响应消息中的指令包括public、private、no-cache、no-store、no-transform、must-revalidate、proxy-revalidate、max-age。各个消息中的指令含义如下:

Public指示响应可被任何缓存区缓存;

Private指示对于单个用户的整个或部分响应消息,不能被共享缓存处理。这允许服务器仅仅描述当用户的部分响应消息,此响应消息对于其他用户的请求无效;

no-cache指示请求或响应消息不能缓存;

no-store用于防止重要的信息被无意的发布。在请求消息中发送将使得请求和响应消息都不使用缓存;

max-age指示客户机可以接收生存期不大于指定时间(以秒为单位)的响应;

min-fresh指示客户机可以接收响应时间小于当前时间加上指定时间的响应;

max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值,那么客户机可以接收超出超时期指定值之内的响应消息。

⑨http-equiv=”imagetoolbar”

<meta http-equiv="imagetoolbar"content="false"/>
Copy after login

指定是否显示图片工具栏,当为false代表不显示,当为true代表显示。

⑩Content-Script-Type

<meta http-equiv="Content-Script-Type" Content="text/javascript">
Copy after login

  以上就是对meta标签如何使用?meta标签使用方法的全部介绍,如果您想了解更多有关HTML视频教程,请关注PHP中文网

The above is the detailed content of How to use meta tags? How to use meta tags. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template