Home  >  Article  >  Web Front-end  >  html的<meta>标签的作用_html/css_WEB-ITnose

html的<meta>标签的作用_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:34:231155browse

标签包含了页面文档的上下文信息。

主要包含的上下文信息:

1.配置了服务器向浏览器响应时,http协议的head信息,浏览器根据head执行相应操作。

2.对页面的描述信息,便于搜索引擎分类查找。

 

在 HTML 中, 标签没有结束标签。
在 XHTML 中, 标签必须被正确地关闭。

 

标签必选的属性是content。

标签可选的属性是name,http-equiv。

 

1.http响应head

适用http-equiv和content属性进行描述。

例如:

使用http-equiv描述的内容会被服务器放入到对浏览器的响应的head中。

浏览器再根据响应head中的内容对文档执行具体的操作。

列如上面的两个http-equiv设置后,会在响应head中包含以下内容。

content-type: text/htmlcharset:gb2312refresh:5;url=http://www.XXXXX.com

含义就是文档是html页面,编码字符集采用gb2312浏览器用这个字符集去解码显示页面,5秒后跳转到另一个url页面。

http-equiv项的设定有很多,具体参考http协议或者用搜索引擎搜。

 

2.页面的描述信息

基本上搜索引擎都会看meta标签对网页进行分类检索。

适用name和content属性进行描述。

列如:

其中最重要的莫过于keywords和description了。

还有可以设置revised,robots(告诉搜索机器人,页面检索的行为),others项。

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn