HTML Dog
跳至导航

Meta 标签

很久很久以前,在互联网还只是用绳子连接起来的几箱纸板的时候,meta 标签曾是互联网……嗯……小镇的报童。

Meta 标签不会对浏览器窗口中显示的内容做任何处理,但搜索引擎等会使用它们来为网页编目。

有一个 meta 标签,您可以在 head 元素内根据需要使用任意次数,并且它们可以包含 charsetnamehttp-equivcontent 属性。

当使用 namehttp-equiv 属性时,content 属性会与它们结合使用,以应用元数据本身。

名称 (Names)

name 属性可以是您喜欢的任何内容。最常用的名称是 authordescriptionkeywordsauthor 用于明确说明 HTML 页面的作者之一,而 description 通常被搜索引擎(如 Google)用于在其搜索结果中显示网页的描述。

HTTP 等效 (HTTP Equivalents)

http-equiv 属性可以代替 name 属性使用,并会生成一个 HTTP 头部,这是发送给存放网页的服务器的信息。这个属性应该很少使用(尽管请参见下面的 charset 说明),但其值可以是


<head>
    <title>Air conditioners? YEAH conditioners!</title>
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="3"><!--not recommended for sane people-->
    <meta name="description" content="This is my really, really, REALLY exciting web page about air conditioners">
    ...