常見<meta>的基本用法詳解

來源:互聯網
上載者:User

標籤:nbsp   idt   代碼   建議   介紹   color   定義   編碼   rip   

<meta charset="utf-8">

定義與name 屬性相關的資訊,使用 utf-8編碼方式編譯字元

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

X-UA-Compatible 是IE8一個專有的<meta>屬性,它告訴IE8採用何種IE版本去渲染網頁,在html的<head>標籤中使用。可以在微軟官方文檔擷取更多介紹。

在IE8剛推出的時候,很多網頁由於重構的問題,無法適應較進階的瀏覽器,所以使用X-UA-Compatible標籤強制IE8採用低版本方式渲染。
使用下面這段代碼後,開發人員無需考慮網頁是否相容IE8瀏覽器,只要確保網頁在IE6、IE7下的表現就可以了。
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
//emulate 模擬

給網站添加X-UA-Compatible標籤

建議使用下面的X-UA-Compatible標籤:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 

IE=edge告訴IE使用最新的引擎渲染網頁,chrome=1則可以啟用Chrome Frame

<meta name="viewport" content="width=device-width, initial-scale=1">

網頁手機wap2.0網頁的head裡加入下面這條元標籤,在iPhone的瀏覽器中頁面將以原始大小顯示,並不允許縮放。 

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">  

width:可視地區的寬度,值可為數字或關鍵詞device-width 
width - viewport的寬度 height - viewport的高度   
intial-scale:頁面首次被顯示是可視地區的縮放層級,取值1.0則頁面按實際尺寸顯示,無任何縮放
maximum-scale=1.0, minimum-scale=1.0;可視地區的縮放層級,maximum-scale使用者可將頁面放大的程式,1.0將禁止使用者放大到實際尺寸之上。
user-scalable - 使用者是否可以手動縮放 

<meta name="keywords" content="">

①Keywords (關鍵字)

說明:為搜尋引擎提供的關鍵字列表
用法:<Meta name="Keywords" Content="關鍵詞1,關鍵詞2,關鍵詞3,關鍵詞4,……">
注意:各關鍵詞間用英文逗號“,”隔開。META的通常用處是指定搜尋引擎用來提高搜尋品質的關鍵詞。當數個META元素提供文檔語言從屬資訊時,搜尋引擎會使用lang特性來過濾並通過使用者的語言優先參照來顯示搜尋結果。例如:

<Meta name="Kyewords" Lang="EN" Content="vacation,greece,sunshine"><Meta name="Kyewords" Lang="FR" Content="vacances,grè:ce,soleil">

②Description (簡介)
說明:Description用來告訴搜尋引擎你的網站主要內容。
用法:

<meta name="description" Content="你網頁的簡述">

 

常見<meta>的基本用法詳解

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.