标签提供关于HTML文档的元数据。元数据不会显示在页面上,可是对于机器是可读的。html
name属性提供了名称/值对中的名称。HTML和XHTML标签都没有指定任何预先定义的<meta>
名称。一般状况下,能够使用对本身和源文档的读者来讲易读富有意义的名称。web
http-equiv属性提供了名称/值对中的名称。并指示服务器在发送实际的文档以前要传送给浏览器的MIME文档头部包含的名称/值对。浏览器
<!-- 使用方法 --> <meta name="参数名" content="参数值"> <!-- 例1:Keywords: 告诉搜索引擎当前网页的关键字 --> <meta name="keywords" content="web,html,study"> <!-- 例2:description: 告诉搜索引擎当前网页的主要内容 --> <meta name="description" content="这个网站是介绍HTML中,<meta>标签的使用"> <!-- 例3:author: 标注当前网页的做者 --> <meta name="author" content="web_xiang">
综上,能够得出name属性,主要是针对网页的一些描述。缓存
<!-- 使用方法 --> <meta http-equiv="参数名" content="参数值"> <!-- Content-Type: 定义页面中使用的字符集--> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- expires: 定义页面资源的有效期 --> <meta http-equiv="expires" content="Mon Aug 10 2020 20:31:45 GMT+0800 (中国标准时间)"> <!-- pragma: 定义请求的catch缓存模式 --> <meta http-equiv="pragma" content="no-cache"> <!-- refresh: 设定网页自动刷新时间,跳转到指定URL,未设置则刷新当前页面 --> <meta http-equiv="refresh" content="2 URL=http://www.baidu.com"> <!-- Set-Cookie: 设定网页请求的cookie --> <meta http-equiv="Set-Cookie" content="cookievalue=xxx; expires=Mon Aug 10 2020 20:31:45 GMT+0800 (中国标准时间); path=/"> <!-- Window-target: 强制页面在当前窗口以独立页面显示 --> <meta http-equiv="Window-target" content="_top">
综上,能够得出http-equiv主要是针对网页请求的一些配置服务器