您的位置:首页 > Web前端 > HTML

HTML基础篇之meta标签

2016-03-10 14:15 405 查看

Meta常见参数及其意义

Meta的常用的标签有很多,这次把这些标签归类来看

Meta基础属性和概念

来自W3C的解释如下:

Metadata is data (information) about data. The tag providesmetadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable. Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata. The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.

元数据是关于数据(信息)。 < meta >标签提供关于HTML文档的元数据。元数据不会显示在页面上,但是将机器解析。Meta元素通常用于指定页面描述,关键词,文档的作者,最后修改和其他元数据。 可以使用元数据浏览器(如何显示内容或重新加载页面),搜索引擎(关键词),或其他web服务。

可以理解为meta就是为了浏览器和搜索引擎准备的一些解释和规则。

我们可以分类为name,http-equiv,content这三种标签。

1.meta之Content

content是指描述的内容,是meta标签必须的属性,如果去掉了会怎样呢?,去掉了手机属性的

试下,效果如下:

去掉content的样式



没有去掉content的样式



content是meta必须具备的属性,不能去掉,否则会导致meta标签失效

2.meta之name

常见的name的值:

<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">


viewport(移动端的窗口) :用于告诉搜索引擎,你是移动端页面

<meta name="format-detection" content="telephone=no, email=no">


format-detection(格式检测) :用于告诉搜索引擎,不需要检测号码和邮箱,不会触发号码和邮箱点击态

<meta name="renderer" content="webkit"> //默认webkit内核
<meta name="renderer" content="ie-comp"> //默认IE兼容模式
<meta name="renderer" content="ie-stand"> //默认IE标准模式


对于PC双核浏览器指定启动的渲染模式

<meta name="description" content="wenyi"/>  //keywords(关键字):用于告诉搜索引擎,你网页的关键字。
<meta name="keywords" content="wenyi"/> //description(关键字) :用于告诉搜索引擎,你网页的关键字。
<meta name="author" content="wenyi">    //author(作者)                 :作者
<meta name="copyright" content="wenyi"> //copyright(版权)      :版权


3.meta之http-equiv

<meta http-equiv="content-Type" content="text/html;charset=utf-8">  //旧的HTML,不推荐
<meta charset="utf-8"> //HTML5设定网页字符集的方式,推荐使用UTF-8


<meta http-equiv="Cache-Control" content="no-siteapp">//百度爬虫防止被转码


4.不常见的标签

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  html w3c meta