你真的了解html嗎?--之meta標簽介紹
Meta data元數據,何為元數據,根據百度百科的解釋為:data about data (關於數據的數據)。網頁中的元數據主要用來描述關於文檔(而不是文檔內容)的一些信息。
網頁中的元數據主要一下幾種方式來指定:1.在文檔中通過meta標簽來製定;2.在文檔外通過link標簽來指定;3.通過head元素的profile屬性來製定。
這邊筆記中主要來說meta元素,Mate中都是以鍵值對的形式出現,name是property,content是value,http-equiv在基於http傳輸時,來代替name。
有時候還會有用到其它的一些屬性,如:lang指定content的語言,Dir指定文字的方向。
這裏我們主要來看看元數據的一些用途。
l Meta與http 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èce, soleil">
l Meta與pics,如:
<HEAD>
<META http-equiv="PICS-Label" content='
(PICS-1.1 "https://www.gcf.org/v2.5"
labels on "1994.11.05T08:15-0500"
until "1995.12.31T23:59-0000"
for "https://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.
最後更新:2017-04-02 04:01:44