meta标签详解
来源:互联网 发布:数据库概论答案 编辑:程序博客网 时间:2024/06/05 12:45
meta标签的作用
- meta标签能大大提高网站被搜索到的可能性
- 用来为搜索引擎robots定义页面主题
- 定义用户浏览器上的cookie;它可以用于鉴别作者,设定页面格式
- 标注内容提要和关键字
- 设置页面使其可以根据你定义的时间间隔刷新
META标签分两大部分:
HTTP标题信息(HTTP-EQUIV)和页面描述信息(NAME)。
name
(1)
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
1、width : 控制viewport(视口)的大小,可以指定一个值或者特殊的值,如device-width为设备的宽度(单位为缩放为100%的CSS的像素)
2、height : 和width相对应,指定高度
3、initial-scale : 初始缩放比例,页面第一次加载时的缩放比例
4、maximum-scale : 允许用户缩放到的最大比例,范围从0到10.0
5、minimum-scale : 允许用户缩放到的最小比例,范围从0到10.0
6、user-scalable : 用户是否可以手动缩放,值可以是:①yes、 true允许用户缩放;②no、false不允许用户缩放
(2)
<!--用以说明生成工具--><meta name="Generator" content="">
(3)
<!--向搜索引擎说明你的网页的关键词--><meta name="Keywords" content="html,css">
(4)
<!-- 告诉搜索引擎你的站点的主要内容--><meta name="Description" content="nothing"> <!-- 告诉搜索引擎你的站点的制作的作者 --> <meta name="Author" content="你的姓名">
(5)
<meta name="Robots" content= "all|none|index|noindex|follow|nofollow">(机器人向导)
设定为all:文件将被检索,且页面上的链接可以被查询;
设定为none:文件将不被检索,且页面上的链接不可以被查询;
设定为index:文件将被检索;
设定为follow:页面上的链接可以被查询;
设定为noindex:文件将不被检索,但页面上的链接可以被查询;
设定为nofollow:文件将不被检索,页面上的链接可以被查询。
http-equiv
<!--设置字符编码和文件格式--><meta http-equiv="Content-Type" content="text/html";charset=utf-8"><!--设置定时刷新--><meta http-equiv="Refresh" content="n;url=http://.......><!-- 告诉浏览器不要缓存页面--><meta http-equiv="Pragma" content="no-cache"><! -- //告诉浏览器不要缓存页面--><meta http-equiv="cache-control" content="no-cache">//告诉浏览器不要缓存页面<!--禁用浏览器缓存此页面--><meta http-equiv="expires" content="0"><!--设置ie的文档兼容模式,设置IE7+的浏览器以IE7的兼容模式查看页面--><meta http-equiv="X-UA-Compatible" content="IE=7">
一个简单的例子
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 --><html lang="zh"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa --><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome --><meta name="renderer" content="webkit|ie-comp|ie-stand"> <!-- 360 浏览器内核控制 --><!--content的取值为webkit,ie-comp,ie-stand之一,区分大小写,分别代表用webkit内核,IE兼容内核,IE标准内核。若页面需默认用极速核,增加标签:<meta name="renderer" content="webkit"> 若页面需默认用ie兼容内核,增加标签:<meta name="renderer" content="ie-comp"> 若页面需默认用ie标准内核,增加标签:<meta name="renderer" content="ie-stand">--><!-- width=device-width 会导致 iPhone 5 添加到主屏后以 WebAPP 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz --><meta name ="viewport" content ="initial-scale=1.0, maximum-scale=3, minimum-scale=1, user-scalable=no"><meta name="apple-mobile-web-app-title" content="标题"> <!-- 添加到主屏时的标题 --><meta name="apple-mobile-web-app-capable" content="yes" /> <!-- 是否启用 WebAPP 全屏模式 --><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <!-- 状态条颜色 --><meta name="format-detection" content="telephone=no" /> <!-- 屏蔽数字自动识别为电话号码 --><!-- favicon 图标 --><link type="image/x-icon" rel="icon" href="http://static.example.com/favicon.ico"/><link type="image/x-icon" rel="shortcut icon" href="http://static.example.com/favicon.ico"/><link type="image/x-icon" rel="bookmark" href="http://static.example.com/favicon.ico"/><!-- iOS 图标 begin --><!--默认 57x57 像素--><link rel="apple-touch-icon-precomposed" href="http://wanke.etao.com/assets/img/icon/57/apple-touch-icon-57x57-precomposed.png" /><!--iPad 1 72x72 像素--><link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://wanke.etao.com/assets/img/icon/72/apple-touch-icon-72x72-precomposed.png" /><!--iPhone 4 114x114 像素--><link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://wanke.etao.com/assets/img/icon/114/apple-touch-icon-114x114-precomposed.png" /><!-- iOS 图标 end --><meta name="msapplication-TileColor" content="#000"/> <!-- Windows 8 磁贴颜色 --><meta name="msapplication-TileImage" content="icon.png"/> <!-- Windows 8 磁贴图标 --><!-- SEO 优化 --><meta name="description" content="" /> <!-- 页面描述 --><meta name="keywords" content=""/> <!-- 页面关键词 --><title>页面标题</title><!-- iOS 应用启动界面设置 begin --><!-- iPad Landscape – 1024 x 748 --><link rel="apple-touch-startup-image" sizes="1024x748" href="img/splash-screen-1024x748.png" /><!-- iPad Portrait – 768 x 1004 --><link rel="apple-touch-startup-image" sizes="768x1004" href="img/splash-screen-768x1004.png" /><!-- iPhone/iPod Touch Portrait – 320 x 480 (standard resolution) --><link rel="apple-touch-startup-image" href="img/splash-screen-320x480.png" /><!-- iPhone/iPod Touch Portrait – 640 x 960 pixels (high-resolution) --><link rel="apple-touch-startup-image" sizes="640x960" href="img/splash-screen-640x960.png" /><!-- iOS 应用启动界面设置 end --></head>
以上是META标签的一些基本用法,其中最重要的就是:Keywords和Description的设定。
为什么呢?道理很简单,这两个语句可以让搜索引擎能准确的发现你,吸引更多的人访问你的站点!根据现在流行搜索引擎(Google,Lycos,AltaVista等)的工作原理,搜索引擎先派机器人自动在WWW上搜索,当发现新的网站时,便于检索页面中的Keywords和Description,并将其加入到自己的数据库,然后再根据关键词的密度将网站排序。
由此看来,我们必须记住添加Keywords和Description的META标签,并尽可能写好关键字和简介。否则,后果就会是:
● 如果你的页面中根本没有Keywords和Description的META标签,那么机器人是无法将你的站点加入数据库,网友也就不可能搜索到你的站点。
● 如果你的关键字选的不好,关键字的密度不高,被排列在几十甚至几百万个站点的后面被点击的可能性也是非常小的。
写好Keywords(关键字)要注意以下几点:
● 不要用常见词汇。例如www、homepage、net、web等。
● 不要用形容词,副词。例如最好的,最大的等。
● 不要用笼统的词汇,要尽量精确。例如“爱立信手机”,改用“T28SC”会更好。
寻找合适关键词的技巧是:到Google、Lycos、Alta等著名搜索引擎,搜索与
你的网站内容相仿的网站,查看排名前十位的网站的META关键字,将它们用在你的网站上,效果可想而知了。
★小窍门
为了提高搜索点击率,这里还有一些“捷径”可以帮得到你:
● 为了增加关键词的密度,将关键字隐藏在页面里(将文字颜色定义成与背景颜色一样)。
● 在图像的ALT注释语句中加入关键字。如:<IMG SRC="xxx.gif" Alt="Keywords">
● 利用HTML的注释语句,在页面代码里加入大量关键字。用法: <!-- 这里插入关键字 -->
- meta标签详解(meta标签的作用)
- meta标签详解(meta标签的作用)
- meta标签详解(meta标签的作用)
- meta标签之详解
- Meta标签详解
- Meta标签详解(转)
- Meta标签详解
- Meta标签详解 (转)
- Meta标签详解
- Meta标签详解
- Meta标签详解
- Meta标签详解
- Meta标签详解
- meta标签之详解
- meta标签之详解
- Meta标签详解
- Meta标签详解
- Meta标签详解
- Linux系统结构及相关操作
- maven 配置jetty-maven-plugin contextPath元素内容要用'/'开头
- python进程、线程、协程
- My fist CSDN blog
- Notepad++远程连接ssh修改linux中配置文件
- meta标签详解
- ehcache
- linux C编程 gdb的使用
- x86汇编指令详解
- Harry And Dig Machine HDU
- 快捷键(backups)
- HTML图像设计
- Tensorflow(一)- 初识tensorflow
- POJ 2486 Apple Tree