meta 標籤的作用
META 是 HTML 中 HEAD 區的關鍵標籤,用來提供字元集、使用語言、作者等文件資訊,也能設定關鍵詞與網頁等級,最大的作用在於協助搜尋引擎優化(SEO),方便搜尋引擎機器人查找與分類。
京東首頁:
<meta charset="gbk">
<meta name="description" content="京東JD.COM-專業的綜合網上購物商城...">
<meta name="Keywords" content="網上購物,網上商城,手機,筆記本,電腦...">
淘寶首頁:
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="description" content="淘寶網 - 亞洲最大、最安全的網上交易平台...">
騰訊網首頁:
<meta charset="UTF-8">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="keywords" content="新聞 新聞中心 事實派 新聞頻道,時事報道">
<meta name="description" content="騰訊新聞,事實派...">
meta 標籤主要分為兩大部分:http-equiv 與 name 屬性。
<meta http-equiv="content-Type" content="text/html; charset=utf-8">。GB2312 代表簡體中文、ISO-8859-1 代表英文、UTF-8 為通用編碼。HTML5 可直接寫 <meta charset="utf-8" />。IE=edge 表示用最高版本;IE=edge,chrome=1 則可啟用 Chrome Frame。<meta http-equiv="Refresh" content="2;URL=https://www.baidu.com">,數字代表停留秒數。no-cache、no-store、max-age、public、private 等。<meta name="author" content="dashen" />。width=device-width, initial-scale=1, user-scalable=no。webkit/ie-comp/ie-stand。觀察各大網站的設定可以發現,最實用的是 X-UA-Compatible、keywords、description 這三項。以上就是本文的全部內容,希望能給大家一個參考。