metadate 元数据 用于描述数据的数据,他不会显示在页面上,确实机器能够识别的。

组成

meta 标签共有两个属性 http-equiv 和 name 属性

name 属性

name 属性 主要用于描述网页,比如网页的关键词,叙述等。对应的是一个content 属性是对name属性的具体描述,便于搜索引擎抓取

<meta name ='参数' content='对参数的描述' />

name 属性的常用值

1
2
3
4
5
6
7
8
1.keywords关键字
2.discription 描述
3.viewport 移动端的窗口
<meta name ='viewport' content ='width=divice-width, initial-scale=1' />
4.robots 定义搜索引擎爬虫的索引方式
5.author 作者
6.generator 制作软件
7.copyright 版权

http-equiv 属性

相当于http 的作用,定义http的头 equiv === equivalent

<meta http-equiv='参数' content='具体的描述' />

http-equiv 属性 常用的值

1
2
3
4
5
6
7
8
1.content-type  设置网页的字符集 ,便于浏览器渲染页面  
<meta http-equiv='content-type' content ='text/html;charset=utf-8' /> <meta charset='utf-8' />`
2.X-UA-Compatible 浏览器采用何种版本渲染当前页面 chrome=1
3.catch-control 设置请求的缓存机制 no-cache 与服务器确实是否改变如果为改变使用缓存 no-store 不使用缓存 max-age 最大缓存时间 使用秒做单位
4.expires 网页的到期时间 到达指定时间之后向服务器重新请求
5.refresh 刷新指向页面 content ='2;http://www.baidu.com' 2秒之后调到百度
6.Set-Cookie 设置cookie的值
<meta http-equiv="Set-Cookie" content="User=Lxxyx; path=/; expires=Sunday, 10-Jan-16 10:00:00 GMT">

参考地址