HTML之——<meta>

<meta>位於<head>標籤之中,不需要結束標籤。
meta標籤分爲:http_equiv和name變量
http_equiv
作用:
1:說明頁面使用的編碼格式
<meta http_equiv="Content-Type" content="text/html;charset=utf-8" >
==><meta charset="utf-8" >[簡單形式]

2:說明頁面使用的語言
<meta http-equiv="Content-Language" content="zh-CN">
("zh-CN"代表中文)

3.定時刷新頁面或者跳轉
刷新:<meta http_equiv="refresh" content="10" >
跳轉:<meta http-equiv="refresh" content="5; url=http://www.dreamdu.com/" />

4.設定期限,一旦超過時間,需要重新請求服務器才能顯示
<!-- 禁止瀏覽器從本地緩存中調閱頁面。-->
<meta http-equiv="pragram" content="no-cache">
<!--網頁不保存在緩存中,每次訪問都刷新頁面。-->
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<!--同上面意思差不多,必須重新加載頁面-->
<meta http-equiv="expires" content="-1">

5.set-cookie【cookie用法需要重點了解】
如果網頁過去,設置的cookie將被刪除
 <meta http-equiv="Set-Cookie" content="cookievalue=xxx; expires=Friday, 12-Jan-2001 18:18:18 GMT; path=/">

6.Window-target(顯示窗口的設定)               
說明:強制頁面在當前窗口以獨立頁面顯示。              
用法:<meta http-equiv="Window-target" content="_top">            
注意:用來防止別人在框架裏調用自己的頁面。

7.Pragma(cache模式)              
說明:禁止瀏覽器從本地計算機的緩存中訪問頁面內容。            
用法:<meta http-equiv="Pragma" content="no-cache">            
注意:這樣設定,訪問者將無法脫機瀏覽。 

8.<meta name="參數" content="具體的參數值"> 【主要是爲了向搜索引擎提供一下信息,提高頁面搜索的點擊率】         
  其中name屬性主要有以下幾種參數:
   重點:viewport     設置頁面不能收縮【移動端,響應式佈局重點】
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
       參數說明:
           height:和 width 相對應,指定高度。
           initial-scale:初始縮放比例,也即是當頁面第一次 load 的時候縮放比例。
           maximum-scale:允許用戶縮放到的最大比例。
           minimum-scale:允許用戶縮放到的最小比例。
           user-scalable:用戶是否可以手動縮放

  1)、Keywords(關鍵字)  
   說明:keywords 用http://www.fulinmenst.com/來告訴搜索引擎你網頁的關鍵字是什麼。            
   舉例<meta name ="key" content="science, elture,polducation,cuitics,ecnomics,relationships, entertaiment, human">  
      
  2)、description(網站內容描述)              
   說明:description用來告訴搜索引擎你的網站主要內容。            
   舉例:  <meta name="description" content="This page is about the meaning of science, education,culture.">         

  3)、robots(機器人嚮導)  【不明所以,參數代表什麼,有什麼用- -。】             
   說明:robots用來告訴搜索機器人哪些頁面需要索引,哪些頁面不需要索引。             
   content的參數有all,none,index,noindex,follow,nofollow。默認是all。             
   舉例:<meta name="robots" content="none">         

  4)、author(作者)               
   說明:標註網頁的作者  
   舉例:<meta name="author" content="root,[email protected]">
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章