What is the meta tag in html? Introduction to attributes of meta tag

青灯夜游
Release: 2018-09-11 18:07:53
Original
4566 people have browsed it

This chapter will introduce to you what is the meta tag in html? Introduction to the attributes of meta tags. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

What is a meta tag?

## The meta tag is a key tag in the head area of ​​the HTML tag. It is located between the and of the HTML document (some are not between and <title>). The information it provides, although not visible to the user, is the most basic meta-information of the document. The meta tag is used to describe the attributes of an HTML web document, such as author, date and time, web page description, keywords, page refresh, etc. <p></p>Note: Meta information is information about information. Meta information allows the server to provide information about the data sent. For example, http can improve the object language and objects sent, and meta information can also be used to implement conditional requests and Report transaction completed. The browser that receives the data can determine what content is sent by the server based on the metainformation, what data is expected, whether complete data is received, and whether there are errors in the process, so that the client can know the type of transmitted object. <p></p> <p><span style="font-size: 18px;">What are the attributes of the meta tag? <strong></strong></span></p> <p><img src="https://img.php.cn//upload/image/402/350/428/1536659975962189.jpg" title="1536659975962189.jpg" alt="What is the meta tag in html? Introduction to attributes of meta tag"></p> <p>Detailed explanation of attributes: <strong></strong></p>1.http-equiv<p></p> is equivalent to http The function of the file header is that it can return some useful information to the browser to help the browser correctly display the content of the web page. <p></p>Syntax: <meta http-equiv="parameters" content="parameter value"> <p></p>Parameters: <p></p>1) content-Type (set page usage Character set)<p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metahttp-equiv="content-Type" content="text/html;charset=gb2312"></pre><div class="contentsignin">Copy after login</div></div></p>http-equiv=Content-Type represents the HTTP header protocol, prompting the browser for web page information. The information parameter of the charset of the <p></p>meta tag is such as GB2312. , which means that the encoding used by the website is Simplified Chinese; when the information parameter of the charset of the <p></p>meta tag is such as BIG5, it means that the encoding used by the website is Traditional Chinese; the charset of the <p></p>meta tag When the information parameter is such as iso-2022-jp, it means that the encoding used by the website is Japanese; when the information parameter of the charset of the <p></p>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 <p>#meta tag is such as ISO-8859-1, it means that the encoding used by the website is English; when the charset information parameter of the </p><p>meta tag is such as UTF-8, it means the world Universal language encoding; </p><p>2) content-Language (display language setting) </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="Content-Language" content="zh-cn"/></pre><div class="contentsignin">Copy after login</div></div><p>3) Expires (period, which can be used to set the expiration time of the web page. Once the web page expires , must be retransmitted to the server) </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="expires" content="Fri,12Jan200118:18:18GMT"></pre><div class="contentsignin">Copy after login</div></div><p>Note: The GMT time format must be used. </p><p>4) Pragma (cache mode, prohibits the browser from accessing page content from the cache of the local computer)</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="Pragma" content="no-cache"></pre><div class="contentsignin">Copy after login</div></div><p>Note: With this setting, visitors will not be able to browse offline. </p><p>5) cache-control (cache settings) </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="cache-control" content="no-cache"></pre><div class="contentsignin">Copy after login</div></div><p>The cache instructions when requesting include no-cache, no-store, max-age, max-stale, min-fresh, only- if-cached, the instructions in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, and max-age. The meaning of the instructions in each message is as follows: </p><p>Public indicates that the response can be cached by any cache area </p><p>Private indicates that the entire or partial response message for a single user cannot be processed by the shared cache. This allows the server to only describe when a user's partial response message is invalid for other users' requests </p><p>no-cache indicates that the request or response message cannot be cached</p><p>no-store is used to prevent important information was released unintentionally. Sending it in the request message will cause both the request and response messages to use caching. </p><p>max-age indicates that the client can receive responses with a lifetime no greater than the specified time in seconds </p><p>min-fresh indicates that the client can receive responses with a lifetime less than the current time plus the specified Time-of-response</p><p>max-stale indicates that the client can receive response messages beyond the timeout period. If you specify a value for max-stale messages, the client can receive response messages that exceed the specified value of the timeout period. </p><p>6) Refresh (automatically refresh and point to the new page) </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="Refresh" content="2; URL=http://www.baidu.com"> //(注意后面的引号,分别在秒数的前面和网址的后面)</pre><div class="contentsignin">Copy after login</div></div><p>Note: The 2 refers to automatically refreshing to the URL after staying for 2 seconds. </p><p>7) Window-target (force the page to be displayed as an independent page in the current window) </p><p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="Window-target" content="_top"></pre><div class="contentsignin">Copy after login</div></div><br/>Note: Used to prevent others from calling your own page in the frame. </p><p>8) set-cookie (cookie setting, if the web page expires, the saved cookie will be deleted) </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv="Set-Cookie" content="cookie value=xxx; expires=Friday,12-Jan-200118:18:18GMT;path=/"></pre><div class="contentsignin">Copy after login</div></div><p> It is usually used to force the browser not to set a cache and re-obtain the page from the server. The following method: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta http-equiv=”pragma” content=”no-cache”> <meta http-equiv=”cache-control” content=”no-cache”> <meta http-equiv=”expires” content=”0″></pre><div class="contentsignin">Copy after login</div></div><p></p>2.name attribute<p><strong></strong> The name attribute is mainly used to describe the web page. The corresponding attribute value is content. The content in content is mainly It is convenient for search engine robots to find and classify information. </p><p> Syntax: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta name="参数" content="具体的参数值"></pre><div class="contentsignin">Copy after login</div></div><p>Keywords(keywords)</p><p> Description: keywords are used to tell search engines what the keywords of your web page are. </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta name="keywords" content=""></pre><div class="contentsignin">Copy after login</div></div><p>description(网站内容描述)</p><p>说明:description用来告诉搜索引擎你的网站主要内容。</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metaname="description" content=""></pre><div class="contentsignin">Copy after login</div></div><p>robots(机器人向导)</p><p>说明:Meta robots标签管理着搜索引擎是否可以进入网页,你可以用它来允许或不允许搜索引擎来获取你的网页、进入你网页中的子链接或对你的网页存档。content的参数有all,none,index,noindex,follow,nofollow。默认是all。</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metaname="robots" content="none"></pre><div class="contentsignin">Copy after login</div></div><p>具体参数如下:</p><p>信息参数为all:文件将被检索,且页面上的链接可以被查询;</p><p>信息参数为none:文件将不被检索,且页面上的链接不可以被查询;</p><p>信息参数为index:文件将被检索;</p><p>信息参数为follow:页面上的链接可以被查询;</p><p>信息参数为noindex:文件将不被检索,但页面上的链接可以被查询;</p><p>信息参数为nofollow:文件将被检索,但页面上的链接不可以被查询;</p><p>author(作者)</p><p>说明:标注网页的作者</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metaname="author" content="jesse131work@163.com"></pre><div class="contentsignin">Copy after login</div></div><p>generator</p><p>说明:meta标签的generator的信息参数,代表说明网站的采用的什么软件制作。</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metaname="generator" content="信息参数"/></pre><div class="contentsignin">Copy after login</div></div><p>copyright</p><p>  说明:meta标签的copyright的信息参数,代表说明网站版权信息。</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><metaname="copyright" content="信息参数"></pre><div class="contentsignin">Copy after login</div></div><p>revisit-after</p><p>  说明:revisit-after代表网站重访,7days代表7天,依此类推,假如我设置,那这样搜索引擎就是7天来一次。使用这个标签的网站,通常是因为网站数据量非常大,被搜索引擎过 于频繁的抓取,会占用过大的资源,影响网站的访问。所以,希望搜索引擎不要天天过来,抓取过一次了,那么等7天后再来。一般的网站是不需要这个标签的。</p><p><meta name="revisit-after" content="7days"></p><p>view-point</p><p>  说明:主要影响移动页面布局</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><meta name="viewport" content="width=device-width, initial-scale=1.0"></pre><div class="contentsignin">Copy after login</div></div><p>content 参数:</p><p>width viewport 宽度(数值/device-width)</p><p>height viewport 高度(数值/device-height)</p><p>initial-scale 初始缩放比例</p><p>maximum-scale 最大缩放比例</p><p>minimum-scale 最小缩放比例</p><p>user-scalable 是否允许用户缩放(yes/no)</p><p><strong>3.content属性</strong></p><p> content属性一般与name和http-equiv属性一起用,视它们的值而定。</p><p><strong>4.charset属性</strong></p><p>charset属性,是html5的属性,可替换<metahttp-equiv="content-Type" content="text/html;charset=gb2312">设置为<meta charset="utf-8"></p><p>设置meta属性的作用是什么?</p><p> meta标签提供关于HTML文档的元数据。元数据不会显示在页面上,但是对于机器是可读的。它可用于浏览器(如何显示内容或重新加载页面),搜索引擎(关键词),或其他 web 服务。meta标签可用于缓存设置,还与SEO优化相关。SEO是指通过采用易于搜索引擎索引的合理手段,使网站各项基本要素适合搜索引擎检索原则并且对用户更友好(Search Engine Friendly),从而更容易被搜索引擎收录及优先排序从属于SEM(搜索引擎营销)。通俗理解是:通过总结搜索引擎的排名规律,对网站进行合理优化,使你的网站在百度和goog的排名提高,让搜索引擎给你带来客户。</p><p> seo优化常用语句如下</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><!-- 页面标题<title>标签(head 头部必须) --> <title>your title</title> <!-- 页面关键词 keywords --> <meta name="keywords" content="your keywords"> <!-- 页面描述内容 description --> <meta name="description" content="your description"> <!-- 定义网页作者 author --> <meta name="author" content="author,email address"> <!-- 定义网页搜索引擎索引方式,robotterms 是一组使用英文逗号「,」分割的值,通常有如下几种取值:none,noindex,nofollow,all,index和follow。 --> <meta name="robots" content="index,follow"></pre><div class="contentsignin">Copy after login</div></div></p>

The above is the detailed content of What is the meta tag in html? Introduction to attributes of meta tag. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!