Home > Web Front-end > HTML Tutorial > What are the functions of meta tags?

What are the functions of meta tags?

php中世界最好的语言
Release: 2018-02-03 10:05:01
Original
2886 people have browsed it

This time I will show you what the role of meta tags is, and what are the precautions when using meta tags. The following is a practical case, let's take a look.

No matter how wonderful your personal website is, it is as difficult to discover as a small boat in the "vast sea" of cyberspace. How to promote your personal website, the first thing people think of is nothing more than the following: Type:

● Log in to your personal website in the search engine

● Add a link to your personal website on a well-known website

● Post a post in the forum to promote your personal website Website

Many people ignore the powerful effect of HTML tagMETA. A good META tag design can greatly improve the possibility of your personal website being searched. Are you interested? Who Let me re-understand the META tag! The

META tag is an auxiliary tag in the HEAD area of ​​the HTML language. It is located between the HTML documenthead tag and the title << tag. It provides information invisible to the user. . The meta tag is usually used to define the page theme for search engine robots, or to define cookies on the user's browser; it can be used to identify the author, set the page format, mark the content summary and keywords; it can also set the page so that it can be based on You define intervals to refresh yourself, as well as set RASC content levels, etc.

Detailed introduction

The following introduces some examples and explanations of tags.

The META tag is divided into two parts: HTTP header information (HTTP-EQUIV) and page description information (NAME).

★HTTP-EQUIV

HTTP-EQUIV is similar to the header protocol of HTTP. It responds to the browser with some useful information to help display web page content correctly and accurately. Commonly used HTTP-EQUIV types are:

1, Content-Type and Content-Language (display character set settings) transferred from Global Online School edu24ol.com transferred from Global Online School edu24ol.com transferred from Global Online School edu24ol.com

Description: Set the character set used by the page to describe the text and language used to create the homepage. The browser will call the corresponding character set to display the page content based on this.

Usage:

<Meta http-equiv="Content-Type" Content="text/html; Charset=gb2312">
<Meta http-equiv="Content-Language" Content="zh-CN">
Copy after login

Note: The META tag defines the character set used by the HTML page as GB2132, which is the national standard Chinese character code. If "charset=GB2312" is replaced with "BIG5", the character set used on this page is the Traditional Chinese Big5 code. When you browse some foreign sites, IE browser will prompt you that you need to download xx language support to display the page correctly. This function is to know which character set needs to be used to display the page by reading the Content-Type attribute of the META tag of the HTML page. If the corresponding character set is not installed in the system, IE will prompt for downloading. Other languages ​​also correspond to different charsets. For example, the Japanese character set is "iso-2022-jp" and the Korean character set is "ks_c_5601".

Content-Type Content can also be: text/xml and other document types;

Charset options: ISO-8859-1 (English), BIG5, UTF-8, SHIFT-Jis, Euc, Koi8-2, us-ascii, x-mac-roman, iso-8859-2, x-mac-ce, iso-2022-jp, x-sjis, x-euc-jp, euc-kr, iso- 2022-kr, gb2312, gb_2312-80, x-euc-tw, x-cns11643-1, x-cns11643-2 and other character sets; the Content of Content-Language can also be: EN, FR and other language codes.

2. Refresh (Refresh) Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com

Description: How long (seconds) does it take for the web page to refresh itself, or How long after which to allow web pages to automatically link to other web pages.

Usage:

<Meta http-equiv="Refresh" Content="30">
<Meta http-equiv="Refresh" Content="5; Url=http://www.xia8.net">
Copy after login

Note: The 5 means that it will automatically refresh to the URL after staying for 5 seconds.

3. Expires (period) Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com Transferred from Global Online School edu24ol.com

Description: Specify the expiration time of the web page in the cache. Once the web page expires , must be read on the server again.

Usage:

<Meta http-equiv="Expires" Content="0">
<Meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT">
Copy after login

Note: You must use the GMT time format, or set it directly to 0 (the number indicates how much time will expire).

4. Pragma (cach mode)

Description: Prohibits the browser from accessing page content from the local machine’s cache.

Usage:

Note: The web page is not saved in the cache, and the page is refreshed every time it is accessed. With this setting, visitors will not be able to browse offline.

5. Set-Cookie (cookie setting)

Description: When the browser visits a certain page, it will be stored in the cache, and it can be read from the cache the next time it is visited again. , to increase speed. Disable caching when you want visitors to refresh your ad's icon every time, or refresh your counter every time. Usually there is no need to disable caching for HTML files. For pages such as ASP, you can disable caching, because every page you see is dynamically generated on the server, and caching is meaningless. If the web page expires, the saved cookies will be deleted.

Usage:

<Meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Wednesday,
21-Oct-98 16:14:21 GMT; path=/">
Copy after login

Note: GMT time format must be used.

6. Window-target (display window setting)

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

用法:

注意:这个属性是用来防止别人在框架里调用你的页面。Content选项:_blank、_top、_self、_parent.

7、Pics-label (网页RSAC等级评定)

说明:在IE的Internet选项中有一项内容设置,可以防止浏览一些受限制的网站,而网站的限制级别就是通过该参数来设置的。

用法::

<META http-equiv="Pics-label" Contect="(PICS-1.1&#39;http://www.rsac.org/ratingsv01.html&#39;I gen comment &#39;RSACi North America Sever&#39; by &#39;inet@microsoft.com&#39;for &#39;http://www.microsoft.com&#39; on &#39;1997.06.30T14:21-0500&#39; r(n0 s0 v0 l0))">
Copy after login

注意:不要将级别设置的太高。RSAC的评估系统提供了一种用来评价Web站点内容的标准。用户可以设置Microsoft Internet Explorer(IE3.0以上)来排除包含有色情和暴力内容的站点。上面这个例子中的HTML取自Microsoft的主页。代码中的(n 0 s 0 v 0 l 0)表示该站点不包含不健康内容。级别的评定是由RSAC,即美国娱乐委员会的评级机构评定的,如果你想进一步了解RSAC评估系统的等级内容,或者你需要评价自己的网站,可以访问RSAC的站点:http://www.rsac.org/.

8、Page-Enter、Page-Exit (进入与退出)

说明:这个是页面被载入和调出时的一些特效。

用法:

<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)">
<Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">
Copy after login

二、

name的content指定实际内容。如:如果指定level(等级)为value(值),则Content可能是beginner(初级)、intermediate(中级)、advanced(高级)。

1、Keywords (关键字)

说明:为搜索引擎提供的关键字列表转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

用法:

注意:各关键词间用英文逗号“,”隔开。META的通常用处是指定搜索引擎用来提高搜索质量的关键词。当数个META元素提供文档语言从属信息时,搜索引擎会使用lang特性来过滤并通过用户的语言优先参照来显示搜索结果。例如:

<Meta name="Kyewords" Content="vacation,greece,sunshine">
<Meta name="Kyewords" Content="vacances,grè:ce,soleil">
Copy after login

2、Description (简介)

说明:Description用来告诉搜索引擎你的网站主要内容。

用法:

注意:

3、Robots (机器人向导)转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

说明:Robots用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。Content的参数有all、none、index、noindex、follow、nofollow。默认是all。

用法:

注意:许多搜索引擎都通过放出robot/spider搜索来登录网站,这些robot/spider就要用到meta元素的一些特性来决定怎样登录。

all:文件将被检索,且页面上的链接可以被查询;

none:文件将不被检索,且页面上的链接不可以被查询;(和 "noindex, no follow" 起相同作用)

index:文件将被检索;(让robot/spider登录)

follow:页面上的链接可以被查询;转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

noindex:文件将不被检索,但页面上的链接可以被查询;(不让robot/spider登录)

nofollow:文件将不被检索,页面上的链接可以被查询。(不让robot/spider顺着此页的连接往下探找)

4、Author (作者)

说明:标注网页的作者或制作组

用法:

<Meta name="Author" Content="张三,abc@sina.com">
Copy after login

注意:Content可以是:你或你的制作组的名字,或Email

5、Copyright (版权)

说明:标注版权转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com转自环 球 网校edu24ol.com

用法:

<Meta name="Copyright" Content="本页版权归Zerospace所有。All Rights Reserved">
Copy after login

6、Generator (编辑器)

说明:编辑器的说明

用法:

<Meta name="Generator" Content="PCDATA|FrontPage|">
Copy after login

注意:Content="你所用编辑器"

相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

怎样解决textarea标签大小不可变不能通过鼠标拖动的方式来拖动的问题

在HTML中select标签怎样实现单选和多选

a标签的href属性与onclick事件应该如何使用

怎样实现meta标签中的viewport来控制设备屏幕的css属性

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

Related labels:
source:php.cn
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