DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> WEB網站前端 >> WEB前端代碼
meta 標籤詳解:那些好用的頁面配置
編輯:WEB前端代碼     

meta 標籤以鍵值對的方式提供頁面元信息,可用來記錄網頁的主要資訊,也支持自定義。它的核心屬性包括 content(必須)、name、http-equiv、scheme、lang。下面按用途分類整理常用的 meta 配置。

一、基礎信息設置

<!-- 設置編碼 -->
<meta http-equiv="Content-Type" Content="text/html; Charset=utf-8" />
<!-- 設置語言 -->
<meta http-equiv="Content-Language" Content="zh-CN" />
<!-- 設置重定向 -->
<meta http-equiv="Refresh" Content="15; Url=https://example.com" />
<!-- 設置緩存時間 -->
<meta http-equiv="Expires" Content="Wed, 26 Jun 2019 18:21:57 GMT" />
<!-- 不使用緩存 -->
<meta http-equiv="Pragma" Content="No-cache" />

二、SEO 相關

<!-- 關鍵字 -->
<meta name="Keywords" Content="key1,key2,..." />
<!-- 描述信息 -->
<meta name="Description" Content="頁面描述" />
<!-- 搜索引擎抓取 -->
<meta name="Robots" Content="All|None|Index|Noindex|Follow|Nofollow" />

三、移動端適配

<!-- 可視區域 -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />

四、瀏覽器相關

<!-- 國產瀏覽器內核選擇 -->
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<!-- 使用最新版 IE 或 Chrome 內核 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<!-- 針對手持設備優化(如黑莓) -->
<meta name="HandheldFriendly" content="true">
<!-- 微軟老式瀏覽器 -->
<meta name="MobileOptimized" content="320">
<!-- UC 強制豎屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ 強制豎屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC 強制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ 強制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC 應用模式 -->
<meta name="browsermode" content="application">
<!-- QQ 應用模式 -->
<meta name="x5-page-mode" content="app">
<!-- Windows Phone 點擊無高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!-- 禁止轉碼 -->
<meta http-equiv="Cache-Control" content="no-siteapp" />

五、禁止自動識別

<!-- 禁止數字被識別為電話號碼 -->
<meta name="format-detection" content="telephone=no" />
<!-- 禁止識別郵箱 -->
<meta name="format-detection" content="email=no" />

六、iOS 專屬

<!-- 啟用 webapp 模式 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 改變 webapp 模式下的外觀 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

七、Windows Phone 專屬

<!-- Windows 8 磁貼顏色 -->
<meta name="msapplication-TileColor" content="#000"/>
<!-- Windows 8 磁貼圖標 -->
<meta name="msapplication-TileImage" content="icon.png"/>

至於 content 中具體鍵值的含義,可結合實際需求自行查閱資料。

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