你真的了解html吗?--之meta标签介绍

来源:互联网 发布:windows10 内存优化 编辑:程序博客网 时间:2024/05/16 08:38

Meta data元数据,何为元数据,根据百度百科的解释为:data about data (关于数据的数据)。网页中的元数据主要用来描述关于文档(而不是文档内容)的一些信息。

 

网页中的元数据主要一下几种方式来指定:1.在文档中通过meta标签来制定;2.在文档外通过link标签来指定;3.通过head元素的profile属性来制定。

    这边笔记中主要来说meta元素,Mate中都是以键值对的形式出现,nameproperty,contentvalue,http-equiv在基于http传输时,来代替name
有时候还会有用到其它的一些属性,如:lang指定content的语言,Dir指定文字的方向。

这里我们主要来看看元数据的一些用途。

l         Metahttp headers

http-equiv来替换name属性,当文档通过http协议传输时,这个属性就有特殊的意义, http server可以通过这个属性指定的信息来生成一个http响应头。

l         Meta与搜索引擎

通过为搜索引擎指定keyword,如:

<-- For speakers of US English -->
<META name="keywords" lang="en-us" 
         content="vacation, Greece, sunshine">
<-- For speakers of British English -->
<META name="keywords" lang="en" 
         content="holiday, Greece, sunshine">
<-- For speakers of French -->
<META name="keywords" lang="fr" 
         content="vacances, Gr&egrave;ce, soleil">
l        Metapics,如:
<HEAD>
 <META http-equiv="PICS-Label" content='
 (PICS-1.1 "http://www.gcf.org/v2.5"
    labels on "1994.11.05T08:15-0500"
      until "1995.12.31T23:59-0000"
      for "http://w3.org/PICS/Overview.html"
    ratings (suds 0.5 density 0 color/hue 1))
 '>
  <TITLE>... document title ...</TITLE>
</HEAD>
l         META 与文档中的默认信息
  • The default scripting language.
  • The default style sheet language.
  • The document character encoding.