云切图

HTML

HTML标签复习,帮你快速掌握html标签,助推学生快速完成网页作业

首页 > 前端笔记 > HTML

整理HTML5头部<meta>标签知识点?html网页设计制作

作者:admin 发布时间:2023-03-11 点击数:
<p>本章给大家介绍关于HTML5头部<meta>标签的小知识。有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助。</p><p>meta是html语言head区的一个辅助性标签,meta标签的作用有很多,比如:搜索引擎优化(seo),定义页面使用语言,自动刷新并指向新的页面,实现网页转换时的动态效果,控制页面缓冲,网页定级评价,控制网页显示的窗口等!</p><p>meta标签的组成:meta标签共有两个属性,它们分别是http-equiv属性和name属性,不同的属性又有不同的参数值,这些不同的参数值就实现了不同的网页功能。</p><h2>一、<meta> 标签的name属性</h2><p>name属性主要用于描述网页,与之对应的属性值为content,content中的内容主要是便于搜索引擎机器人查找信息和分类信息用的。</p><p>meta标签的name属性语法格式是:</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="参数"content="具体的参数值"></pre><p>其中name属性主要有以下几种参数:</p><p>1、Keywords(关键字)</p><p>说明:keywords用来告诉搜索引擎你网页的关键字是什么。</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="keywords"content="meta总结,html&nbsp;meta,meta属性,meta跳转"></pre><p>2、description(网站内容描述)</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="description"content="云切图博客,html的meta总结,meta是html语言head区的一个辅助性标签。"></pre><p>说明:description用来告诉搜索引擎你的网站主要内容。</p><p>3、robots(机器人向导)</p><p>说明:robots用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。</p><p>content的参数有all,none,index,noindex,follow,nofollow。默认是all。</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="robots"content="none"></pre><p>具体参数如下:</p><p>信息参数为all:文件将被检索,且页面上的链接可以被查询;</p><p>信息参数为none:文件将不被检索,且页面上的链接不可以被查询;</p><p>信息参数为index:文件将被检索;</p><p>信息参数为follow:页面上的链接可以被查询;</p><p>信息参数为noindex:文件将不被检索,但页面上的链接可以被查询;</p><p>信息参数为nofollow:文件将被检索,但页面上的链接不可以被查询;</p><p>4、author(作者)</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="author"content="root,root@xxxx.com"></pre><p>说明:标注网页的作者</p><p>5、generator</p><pre class="brush:html;toolbar:false"><meta&nbsp;name="generator"content="信息参数"/></pre><p>meta标签的generator的信息参数,代表说明网站的采用的什么软件制作。</p><p>6、COPYRIGHT</p><pre class="brush:html;toolbar:false"><META&nbsp;NAME="COPYRIGHT"CONTENT="信息参数"></pre><p>meta标签的COPYRIGHT的信息参数,代表说明网站版权信息。</p><h2>二、<meta> 标签的http-equiv属性</h2><p>http-equiv顾名思义,相当于http的文件头作用,它可以向浏览器传回一些有用的信息,以帮助正确和精确地显示网页内容,与之对应的属性值为content,content中的内容其实就是各个参数的变量值。</p><p>meta标签的http-equiv属性语法格式是:</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="参数"content="参数变量值">;</pre><p>其中http-equiv属性主要有以下几种参数:</p><p>1、Expires(期限)</p><p>说明:可以用于设定网页的到期时间。一旦网页过期,必须到服务器上重新传输。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="expires"content="Fri,12Jan200118:18:18GMT"></pre><p>注意:必须使用GMT的时间格式。</p><p>2、Pragma(cache模式)</p><p>说明:禁止浏览器从本地计算机的缓存中访问页面内容。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="Pragma"content="no-cache"></pre><p>注意:这样设定,访问者将无法脱机浏览。</p><p>3、Refresh(刷新)</p><p>说明:自动刷新并指向新页面。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="Refresh"content="2;URL=http://www.haorooms.com">&nbsp;//(注意后面的引号,分别在秒数的前面和网址的后面)</pre><p>注意:其中的2是指停留2秒钟后自动刷新到URL网址。</p><p>4、Set-Cookie(cookie设定)</p><p>说明:如果网页过期,那么存盘的cookie将被删除。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="Set-Cookie"content="cookie&nbsp;value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/"></pre><p>注意:必须使用GMT的时间格式。</p><p>5、Window-target(显示窗口的设定)</p><p>说明:强制页面在当前窗口以独立页面显示。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="Window-target"content="_top"></pre><p>注意:用来防止别人在框架里调用自己的页面。</p><p>6、content-Type(显示字符集的设定)</p><p>说明:设定页面使用的字符集。</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="content-Type"content="text/html;charset=gb2312"></pre><p>具体如下:</p><p>meta标签的charset的信息参数如GB2312时,代表说明网站是采用的编码是简体中文;</p><p>meta标签的charset的信息参数如BIG5时,代表说明网站是采用的编码是繁体中文;</p><p>meta标签的charset的信息参数如iso-2022-jp时,代表说明网站是采用的编码是日文;</p><p>meta标签的charset的信息参数如ks_c_5601时,代表说明网站是采用的编码是韩文;</p><p>meta标签的charset的信息参数如ISO-8859-1时,代表说明网站是采用的编码是英文;</p><p>meta标签的charset的信息参数如UTF-8时,代表世界通用的语言编码;</p><p>7、content-Language(显示语言的设定)</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="Content-Language"content="zh-cn"/></pre><p>8、http-equiv="imagetoolbar"</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv="imagetoolbar"content="false"/></pre><p>指定是否显示图片工具栏,当为false代表不显示,当为true代表显示。</p><p>9、Content-Script-Type</p><pre class="brush:html;toolbar:false"><Meta&nbsp;http-equiv="Content-Script-Type"Content="text/javascript"></pre><p>W3C网页规范,指明页面中脚本的类型。</p><h2>三、常用的<meta> 标签写法</h2><p>1、声明文档使用的字符编码:<meta charset=’utf-8′></p><p>2、优先使用 IE 最新版本和 Chrome:</p><pre class="brush:html;toolbar:false"><meta&nbsp;http-equiv=”X-UA-Compatible”&nbsp;content=”IE=edge,chrome=1″/></pre><p>3、页面描述:<meta name=”description” content=”不超过150个字符”/></p><p>4、页面关键词:<meta name=”keywords” content=””/></p><p>5、网页作者:<meta name=”author” content=”name, email@gmail.com”/></p><p>6、搜索引擎抓取:<meta name=”robots” content=”index,follow”/></p><p>7、为移动设备添加 viewport:</p><pre class="brush:html;toolbar:false"><meta&nbsp;name=”viewport”&nbsp;content=”initial-scale=1,&nbsp;maximum-scale=3,&nbsp;minimum-scale=1,&nbsp;user-scalable=no”></pre><p>8、iOS 设备 begin:<meta name=”apple-mobile-web-app-title” content=”标题”></p><p>9、添加到主屏后的标题(iOS 6 新增):<meta name=”apple-mobile-web-app-capable” content=”yes”/></p><p>10、启用360浏览器的极速模式(webkit):<meta name=”renderer” content=”webkit”></p><p>11、避免IE使用兼容模式:<meta http-equiv=”X-UA-Compatible” content=”IE=edge”></p><p>12、不让百度转码:<meta http-equiv=”Cache-Control” content=”no-siteapp” /></p><p>13、微软的老式浏览器:<meta name=”MobileOptimized” content=”320″></p><p>14、强制竖屏:</p><p>uc强制竖屏:<meta name=”screen-orientation” content=”portrait”</p><p>QQ强制竖屏:<meta name=”x5-orientation” content=”portrait”</p><p>UC强制全屏<meta name=”full-screen” content=”yes”</p><p>QQ强制全屏:<meta name=”x5-fullscreen” content=”true”></p><p>15、点击无高光:<meta name=”msapplication-tap-highlight” content=”no”> windows phone</p>

关注我们共同进步

  • 扣扣交流群

  • 微信公众号

  • 私技术顾问

标签:

html meta
嘿,我来帮您!