DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> HTML基礎知識 >> HTML和Xhtml
HTML meta 標籤使用總結(推薦收藏)
編輯:HTML和Xhtml     

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 詳解

meta 標籤主要分為兩大部分:http-equiv 與 name 屬性。

http-equiv(模擬 HTTP 標頭)

  • content-Type:設定頁面字元集,如 <meta http-equiv="content-Type" content="text/html; charset=utf-8">。GB2312 代表簡體中文、ISO-8859-1 代表英文、UTF-8 為通用編碼。HTML5 可直接寫 <meta charset="utf-8" />。
  • X-UA-Compatible:IE8 專用,用來指定 IE 以哪個版本引擎渲染,如 IE=edge 表示用最高版本;IE=edge,chrome=1 則可啟用 Chrome Frame。
  • expires:設定網頁過期時間,須使用 GMT 格式。
  • refresh:自動刷新並跳轉,如 <meta http-equiv="Refresh" content="2;URL=https://www.baidu.com">,數字代表停留秒數。
  • cache-control:控制快取機制,如 no-cache、no-store、max-age、public、private 等。

name(描述網頁)

  • author:標註作者,<meta name="author" content="dashen" />。
  • keywords:頁面關鍵詞,供搜尋引擎收錄。
  • description:頁面描述,會顯示在搜尋結果中。
  • viewport:控制行動裝置縮放,width=device-width, initial-scale=1, user-scalable=no。
  • renderer:指定雙核瀏覽器(如 360)預設渲染方式,webkit/ie-comp/ie-stand。
  • robots:告知搜尋機器人是否索引,取值 all/none/index/noindex/follow/nofollow,預設 all。
  • copyright:網站版權資訊。

總結

觀察各大網站的設定可以發現,最實用的是 X-UA-Compatible、keywords、description 這三項。以上就是本文的全部內容,希望能給大家一個參考。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved