HTML | 2017年最新的 <head> 元素指南

整理了一份關(guān)于可以寫入到HTML 標(biāo)簽中的內(nèi)容清單-2017年最新的 <head>元素指南躬充,主要內(nèi)容來自 <head> cheatsheet ,讓大家了解每個(gè)標(biāo)簽及相應(yīng)屬性的意義诉濒,寫出滿足自己需求的 <head>頭部標(biāo)簽,可以很有效的增強(qiáng)頁(yè)面的可用性。

最小推薦

<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- 以上 3 個(gè) meta 標(biāo)簽 *必須* 放在 head 的最前面攻冷;其他任何的 head 內(nèi)容必須在這些標(biāo)簽的 *后面* -->
<title>頁(yè)面標(biāo)題</title>

網(wǎng)頁(yè)元素

<!-- 文檔標(biāo)題 -->
<title>頁(yè)面標(biāo)題</title>
 
<!-- 基本 URL 作用于文檔中所包含的所有相對(duì) URL -->
<base >
 
<!-- 外部的 CSS -->
<link rel="stylesheet" href="styles.css">
 
<!-- 文檔內(nèi)的 CSS -->
<style>
  /* ... */
</style>
 
<!-- JavaScript -->
<script src="script.js"></script>
<noscript><!--無(wú) JS 時(shí)的替代--></noscript>

Meta 標(biāo)簽

<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- 以上 3 個(gè) meta 標(biāo)簽 *必須* 放在 head 的最前面;其他任何的 head 內(nèi)容必須在這些標(biāo)簽的 *后面* -->
 
<!-- 對(duì)外部資源加載的限制(允許控制從哪里加載資源) -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
<!-- 盡早地放置在文檔中 -->
<!-- 僅應(yīng)用于該標(biāo)簽下的內(nèi)容 -->
 
<!-- Web 應(yīng)用的名稱(僅當(dāng)網(wǎng)站被用作為一個(gè)應(yīng)用時(shí)才使用)-->
<meta name="application-name" content="應(yīng)用名稱">
 
<!-- 針對(duì)頁(yè)面的簡(jiǎn)短描述(限制 150 字符)-->
<!-- 在*某些*情況下遍希,該描述是被用作搜索結(jié)果展示片段的一部分 -->
<meta name="description" content="一個(gè)頁(yè)面描述">
 
<!-- 控制搜索引擎的抓取和索引行為 -->
<meta name="robots" content="index,follow"><!-- 所有搜索引擎 -->
<meta name="googlebot" content="index,follow"><!-- 僅對(duì) Google 有效 -->
 
<!-- 告訴 Google 不顯示網(wǎng)站鏈接的搜索框 -->
<meta name="google" content="nositelinkssearchbox">
 
<!-- 告訴 Google 不提供此頁(yè)面的翻譯 -->
<meta name="google" content="notranslate">
 
<!-- 驗(yàn)證 Google 搜索控制臺(tái)的所有權(quán) -->
<meta name="google-site-verification" content="verification_token">
 
<!-- 驗(yàn)證 Yandex 網(wǎng)站管理員的所有權(quán) -->
<meta name="yandex-verification" content="verification_token">
 
<!-- 驗(yàn)證 Bing 網(wǎng)站管理員中心的所有權(quán) -->
<meta name="msvalidate.01" content="verification_token">
 
<!-- 驗(yàn)證 Alexa 控制臺(tái)的所有權(quán) -->
<meta name="alexaVerifyID" content="verification_token">
 
<!-- 驗(yàn)證 Pinterest 控制臺(tái)的所有權(quán) -->
<meta name="p:domain_verify" content="code from pinterest">
 
<!-- 驗(yàn)證 Norton 安全站點(diǎn)的所有權(quán) -->
<meta name="norton-safeweb-site-verification" content="norton code">
 
<!-- 用來命名軟件或用于構(gòu)建網(wǎng)頁(yè)(如 - WordPress等曼、Dreamweaver)-->
<meta name="generator" content="program">
 
<!-- 關(guān)于你的網(wǎng)站主題的簡(jiǎn)短描述 -->
<meta name="subject" content="你的網(wǎng)站主題">
 
<!-- 基于網(wǎng)站內(nèi)容給出一般的年齡分級(jí) -->
<meta name="rating" content="General">
 
<!-- 允許控制 referrer 信息如何傳遞 -->
<meta name="referrer" content="no-referrer">
 
<!-- 禁用自動(dòng)檢測(cè)和格式化可能的電話號(hào)碼 -->
<meta name="format-detection" content="telephone=no">
 
<!-- 通過設(shè)置為 “off” 完全退出 DNS 預(yù)取 -->
<meta http-equiv="x-dns-prefetch-control" content="off">
 
<!-- 在客戶端存儲(chǔ) cookie,web 瀏覽器的客戶端識(shí)別 -->
<meta http-equiv="set-cookie" content="name=value; expires=date; path=url">
 
<!-- 指定要顯示在一個(gè)特定框架中的頁(yè)面 -->
<meta http-equiv="Window-Target" content="_value">
 
<!-- 地理標(biāo)簽 -->
<meta name="ICBM" content="latitude, longitude">
<meta name="geo.position" content="latitude;longitude">
<meta name="geo.region" content="country[-state]"><!-- 國(guó)家代碼 (ISO 3166-1): 強(qiáng)制性, 州代碼 (ISO 3166-2): 可選; 如 content="US" / content="US-NY" -->
<meta name="geo.placename" content="city/town"><!-- 如 content="New York City" -->

Google 可以識(shí)別的 Meta 標(biāo)簽
WHATWG Wiki: Meta 拓展
ICBM – 維基百科
地理標(biāo)記 – 維基百科

鏈接

<!-- 表明一個(gè) CSS 樣式表 -->
<link rel="stylesheet" >
 
<!-- 有助于防止出現(xiàn)內(nèi)容重復(fù)的問題 -->
<link rel="canonical" >
 
<!-- 之前用于包含 icon 鏈接凿蒜,但已被廢棄并不再使用 -->
<link rel="shortlink" >
 
<!-- 鏈接到當(dāng)前文檔的一個(gè) AMP HTML 版本 -->
<link rel="amphtml" >
 
<!-- 鏈接到一個(gè)指定 Web 應(yīng)用程序“安裝”證書的 JSON 文件 -->
<link rel="manifest" href="manifest.json">
 
<!-- 鏈接到文檔的作者 -->
<link rel="author" href="humans.txt">
 
<!-- 指向一個(gè)適用于鏈接內(nèi)容的版權(quán)申明 -->
<link rel="license" href="copyright.html">
 
<!-- 給出可能的你的另一種語(yǔ)言的文檔位置參考 -->
<link rel="alternate"  hreflang="es">
 
<!-- 提供了關(guān)于作者或其他人的信息 -->
<link rel="me"  type="text/html">
<link rel="me" href="mailto:name@example.com">
<link rel="me" href="sms:+15035550125">
 
<!-- 鏈接到一個(gè)描述歷史記錄禁谦、文檔或其他具有歷史意義的材料的集合的文檔。 -->
<link rel="archives" >
 
<!-- 鏈接到層次結(jié)構(gòu)中的頂級(jí)資源 -->
<link rel="index" >
 
<!-- 給出一個(gè)自我參考 - 當(dāng)文檔有多個(gè)可能的參考時(shí)非常有用 -->
<link rel="self" type="application/atom+xml" >
 
<!-- 分別是在一系列文件中的第一個(gè)废封、下一個(gè)州泊、上一個(gè)和最后一個(gè) -->
<link rel="first" >
<link rel="next" >
<link rel="prev" >
<link rel="last" >
 
<!-- 當(dāng)使用第三方服務(wù)來維護(hù) blog 時(shí)使用 -->
<link rel="EditURI"  type="application/rsd+xml" title="RSD">
 
<!-- 當(dāng)另一個(gè) WordPress 博客鏈接到你的 WordPress 博客或文章時(shí)形成一個(gè)自動(dòng)化的評(píng)論 -->
<link rel="pingback" >
 
<!-- 當(dāng)你在自己的頁(yè)面上鏈接到一個(gè) url 時(shí)通知它 -->
<link rel="webmention" >
 
<!-- 加載一個(gè)外部的 HTML 文件到當(dāng)前 HTML 文件中 -->
<link rel="import" href="/path/to/component.html">
 
<!-- 打開搜索 -->
<link rel="search" href="/open-search.xml" type="application/opensearchdescription+xml" title="Search Title">
 
<!-- Feeds -->
<link rel="alternate"  type="application/rss+xml" title="RSS">
<link rel="alternate"  type="application/atom+xml" title="Atom 0.3">
 
<!-- 預(yù)取,預(yù)載漂洋,預(yù)瀏覽 -->
<link rel="dns-prefetch" >
<link rel="preconnect" >
<link rel="prefetch" >
<link rel="prerender" >
<link rel="preload" href="image.png" as="image">
<!-- 更多信息:https://css-tricks.com/prefetching-preloading-prebrowsing/ -->

網(wǎng)站圖標(biāo)

<!-- 針對(duì) IE 10 及以下版本 -->
<!-- 如果將 `favicon.ico` 放在根目錄下遥皂,則無(wú)需標(biāo)簽 -->
 
<!-- 對(duì)于 IE 11、Chrome刽漂、Firefox演训、Safari 和 Opera -->
<link rel="icon" type="image/png" sizes="16x16" href="/path/to/favicon-16x16.png"/>
<link rel="icon" type="image/png" sizes="32x32" href="/path/to/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="96x96" href="/path/to/favicon-96x96.png"/>
<!-- 更多信息: https://bitsofco.de/all-about-favicons-and-touch-icons/ -->

所有關(guān)于網(wǎng)站圖標(biāo)(和觸摸圖標(biāo))的信息
網(wǎng)站圖標(biāo)對(duì)照表

社交

Facebook Open Graph

<meta property="fb:app_id" content="123456789"/>
<meta property="og:url" content="https://example.com/page.html"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="Content Title"/>
<meta property="og:image" content="https://example.com/image.jpg"/>
<meta property="og:description" content="Description Here"/>
<meta property="og:site_name" content="Site Name"/>
<meta property="og:locale" content="en_US"/>
<meta property="article:author" content=""/>

Facebook 的 Open Graph 的標(biāo)記
Open Graph 協(xié)議

Facebook Instant Articles

<meta charset="utf-8"/>
<meta property="op:markup_version" content="v1.0"/>
 
<!-- 你的文章的 Web 版網(wǎng)址 -->
<link rel="canonical" />
 
<!-- 用于該文章的樣式 -->
<meta property="fb:article_style" content="myarticlestyle"/>

Facebook Instant Articles: 創(chuàng)建文章
Instant Articles: 格式參考

Twitter Cards

<meta name="twitter:card" content="summary"/>
<meta name="twitter:site" content="@site_account"/>
<meta name="twitter:creator" content="@individual_account"/>
<meta name="twitter:url" content="https://example.com/page.html"/>
<meta name="twitter:title" content="Content Title"/>
<meta name="twitter:description" content="Content description less than 200 characters"/>
<meta name="twitter:image" content="https://example.com/image.jpg"/>

Twitter 名片:入門指南
Twitter 名片驗(yàn)證

Google+ / Schema.org

<link  rel="publisher"/>
<meta itemprop="name" content="內(nèi)容標(biāo)題"/>
<meta itemprop="description" content="內(nèi)容描述少于 200 個(gè)字符"/>
<meta itemprop="image" content="https://example.com/image.jpg"/>

OEmbed

<link rel="alternate" type="application/json+oembed"
  
  title="oEmbed Profile: JSON"/>
<link rel="alternate" type="text/xml+oembed"
  
  title="oEmbed Profile: XML"/>

瀏覽器 / 平臺(tái)

Apple iOS

<!-- 智能應(yīng)用 Banner -->
<meta name="apple-itunes-app" content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT"/>
 
<!-- 禁用自動(dòng)檢測(cè)和格式化可能的電話號(hào)碼 -->
<meta name="format-detection" content="telephone=no"/>
 
<!-- 添加到主屏幕 -->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="apple-mobile-web-app-title" content="應(yīng)用標(biāo)題"/>
 
<!-- 觸摸圖標(biāo) -->
<!-- 在大多數(shù)情況下,在 `<head>` 中贝咙,一個(gè) 180×180px 觸摸圖標(biāo)就已經(jīng)足夠了 -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png"/>
<!-- 注意:iOS 7 上的 Safari 不會(huì)對(duì)圖標(biāo)產(chǎn)生效果样悟。 -->
<!-- 較早版本的 Safari 不會(huì)對(duì)以 `-precomposed.png` 后綴命名的圖標(biāo)文件產(chǎn)生效果。 -->
 
<!-- 啟動(dòng)畫面(已無(wú)效) -->
<link rel="apple-touch-startup-image" href="path/to/startup.png"/>
 
<!-- iOS 應(yīng)用深層鏈接 -->
<meta name="apple-itunes-app" content="app-id=APP-ID, app-argument=http/url-sample.com"/>
<link rel="alternate" href="ios-app://APP-ID/http/url-sample.com"/>

Apple Meta 標(biāo)簽

Apple Safari

<!-- 固定網(wǎng)站 -->
<link rel="mask-icon" href="path/to/icon.svg" color="red"/>

Google Android

<meta name="theme-color" content="#E64545"/>
 
<!-- 添加到主屏幕 -->
<meta name="mobile-web-app-capable" content="yes"/>
<!-- 更多信息:https://developer.chrome.com/multidevice/android/installtohomescreen -->

Google Chrome

<link rel="chrome-webstore-item" />
 
<!-- 禁用翻譯提示 -->
<meta name="google" content="notranslate"/>

Microsoft Internet Explorer

<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<meta name="skype_toolbar" content="skype_toolbar_parser_compatible"/>
 
<!-- IE10: 禁用鏈接點(diǎn)擊高亮 (https://blogs.windows.com/buildingapps/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10/) -->
<meta name="msapplication-tap-highlight" content="no"/>
 
<!-- 固定網(wǎng)站 (https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx) -->
<meta name="application-name" content="Sample Title"/>
<meta name="msapplication-tooltip" content="A description of what this site does."/>
<meta name="msapplication-starturl" content="http://example.com/index.html?pinned=true"/>
<meta name="msapplication-navbutton-color" content="#FF3300"/>
<meta name="msapplication-window" content="width=800;height=600"/>
<meta name="msapplication-task" content="name=Task 1;action-uri=http://host/Page1.html;icon-uri=http://host/icon1.ico"/>
<meta name="msapplication-task" content="name=Task 2;action-uri=http://microsoft.com/Page2.html;icon-uri=http://host/icon2.ico"/>
<meta name="msapplication-badge" value="frequency=NUMBER_IN_MINUTES;polling-uri=http://example.com/path/to/file.xml"/>
<meta name="msapplication-TileColor" content="#FF3300"/>
<meta name="msapplication-TileImage" content="path/to/tileimage.jpg"/>
 
<meta name="msapplication-config" content="http://example.com/browserconfig.xml"/>
<meta name="msapplication-notification" content="frequency=60;polling-uri=http://example.com/livetile;polling-uri2=http://example.com/livetile2"/>
<meta name="msapplication-task-separator" content="1"/>

國(guó)內(nèi)的瀏覽器

360 瀏覽器

<!-- 選擇渲染引擎 -->
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>

QQ 移動(dòng)瀏覽器

<!-- 在指定方向上鎖定屏幕(鎖定橫/豎屏) -->
<meta name="x5-orientation" content="landscape/portrait"/>
<!-- 全屏顯示此頁(yè)面 -->
<meta name="x5-fullscreen" content="true"/>
<!-- 頁(yè)面將以“應(yīng)用模式”顯示(全屏等)-->
<meta name="x5-page-mode" content="app"/>

UC 移動(dòng)瀏覽器

<!-- 在指定方向上鎖定屏幕(鎖定橫/豎屏) -->
<meta name="screen-orientation" content="landscape/portrait"/>
<!-- 全屏顯示此頁(yè)面 -->
<meta name="full-screen" content="yes"/>
<!-- 即使在“文本模式”下庭猩,UC 瀏覽器也會(huì)顯示圖片 -->
<meta name="imagemode" content="force"/>
<!-- 頁(yè)面將以“應(yīng)用模式”顯示(全屏窟她、禁止手勢(shì)等) -->
<meta name="browsermode" content="application"/>
<!-- 在此頁(yè)面禁用 UC 瀏覽器的“夜間模式” -->
<meta name="nightmode" content="disable"/>
<!-- 簡(jiǎn)化頁(yè)面,減少數(shù)據(jù)傳輸 -->
<meta name="layoutmode" content="fitscreen"/>
<!-- 禁用的 UC 瀏覽器的功能蔼水,“當(dāng)此頁(yè)面中有較多文本時(shí)縮放字體” -->
<meta name="wap-font-scale" content="no"/>

應(yīng)用鏈接

<!-- iOS -->
<meta property="al:ios:url" content="applinks://docs"/>
<meta property="al:ios:app_store_id" content="12345"/>
<meta property="al:ios:app_name" content="App Links"/>
<!-- Android -->
<meta property="al:android:url" content="applinks://docs"/>
<meta property="al:android:app_name" content="App Links"/>
<meta property="al:android:package" content="org.applinks"/>
<!-- Web 回退 -->
<meta property="al:web:url" content="http://applinks.org/documentation"/>
<!-- 更多信息:http://applinks.org/documentation/ -->

應(yīng)用鏈接文檔

注意

性能

<link  rel="stylesheet"/>

其他資源

HTML5 樣板文檔:HTML 標(biāo)簽
HTML5 樣板文檔:擴(kuò)展和定制

相關(guān)項(xiàng)目

Atom HTML Head 片段 – Atom HEAD
片段包
Sublime Text HTML Head 片段 – Sublime Text HEAD
片段包
head-it – HEAD
片段的 CLI 接口
vue-head – 在 Vue.js 中操作 HEAD
標(biāo)簽的 meta 信息

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末震糖,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子趴腋,更是在濱河造成了極大的恐慌试伙,老刑警劉巖嘁信,帶你破解...
    沈念sama閱讀 218,386評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異疏叨,居然都是意外死亡潘靖,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,142評(píng)論 3 394
  • 文/潘曉璐 我一進(jìn)店門蚤蔓,熙熙樓的掌柜王于貴愁眉苦臉地迎上來卦溢,“玉大人,你說我怎么就攤上這事秀又〉ゼ牛” “怎么了?”我有些...
    開封第一講書人閱讀 164,704評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵吐辙,是天一觀的道長(zhǎng)宣决。 經(jīng)常有香客問我,道長(zhǎng)昏苏,這世上最難降的妖魔是什么尊沸? 我笑而不...
    開封第一講書人閱讀 58,702評(píng)論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮贤惯,結(jié)果婚禮上洼专,老公的妹妹穿的比我還像新娘。我一直安慰自己孵构,他們只是感情好屁商,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,716評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著颈墅,像睡著了一般蜡镶。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上恤筛,一...
    開封第一講書人閱讀 51,573評(píng)論 1 305
  • 那天帽哑,我揣著相機(jī)與錄音,去河邊找鬼叹俏。 笑死,一個(gè)胖子當(dāng)著我的面吹牛僻族,可吹牛的內(nèi)容都是我干的粘驰。 我是一名探鬼主播,決...
    沈念sama閱讀 40,314評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼述么,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼蝌数!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起度秘,我...
    開封第一講書人閱讀 39,230評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤顶伞,失蹤者是張志新(化名)和其女友劉穎饵撑,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體唆貌,經(jīng)...
    沈念sama閱讀 45,680評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡滑潘,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,873評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了锨咙。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片语卤。...
    茶點(diǎn)故事閱讀 39,991評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖酪刀,靈堂內(nèi)的尸體忽然破棺而出粹舵,到底是詐尸還是另有隱情,我是刑警寧澤骂倘,帶...
    沈念sama閱讀 35,706評(píng)論 5 346
  • 正文 年R本政府宣布眼滤,位于F島的核電站,受9級(jí)特大地震影響历涝,放射性物質(zhì)發(fā)生泄漏诅需。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,329評(píng)論 3 330
  • 文/蒙蒙 一睬关、第九天 我趴在偏房一處隱蔽的房頂上張望诱担。 院中可真熱鬧,春花似錦电爹、人聲如沸蔫仙。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,910評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)摇邦。三九已至,卻和暖如春屎勘,著一層夾襖步出監(jiān)牢的瞬間施籍,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,038評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工概漱, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留丑慎,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,158評(píng)論 3 370
  • 正文 我出身青樓瓤摧,卻偏偏與公主長(zhǎng)得像竿裂,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子照弥,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,941評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容