山神姐 發表於 2019-7-6 09:37:00

HTML5 meta 属性整理

<pre>&lt;!DOCTYPE html&gt; &lt;!-- 使用 HTML5 doctype,不区分大小写 --&gt;
&lt;html lang="zh-cmn-Hans"&gt; <br>&lt;!-- </pre>
<div>
<div>
<p style="margin-left: 30px">1. 简体中文页面:html lang=zh-cmn-Hans<br>2. 繁体中文页面:html lang=zh-cmn-Hant<br>3. 英语页面:html lang=en</p>
<p style="margin-left: 30px">4. 《回来》的音频,以国语演唱:audio lang=zh-cmn<br>5. 《海阔天空》的音频,以粤语演唱:audio lang=yue<br>6. 《进来白相相》的音频,以沪语演唱:audio lang=wuu<br>注意上述因为都是音频,所以不应加上 Hans/Hant 标记。</p>
</div>
</div>
<pre>更加标准的 lang 属性写法 http://zhi.hu/XyIa --&gt;
&lt;head&gt;
    &lt;!-- 声明文档使用的字符编码 --&gt;
    &lt;meta charset='utf-8'&gt;
    &lt;!-- 优先使用 IE 最新版本和 Chrome --&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/&gt;
    &lt;!-- 页面描述 --&gt;
    &lt;meta name="description" content="不超过150个字符"/&gt;
    &lt;!-- 页面关键词 --&gt;
    &lt;meta name="keywords" content=""/&gt;
    &lt;!-- 网页作者 --&gt;
    &lt;meta name="author" content="name, email@gmail.com"/&gt;
    &lt;!-- 搜索引擎抓取 --&gt;
    &lt;meta name="robots" content="index,follow"/&gt;
    &lt;!-- 为移动设备添加 viewport --&gt;
    &lt;meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"&gt;
    &lt;!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz --&gt;

    &lt;!-- iOS 设备 begin --&gt;
    &lt;meta name="apple-mobile-web-app-title" content="标题"&gt;
    &lt;!-- 添加到主屏后的标题(iOS 6 新增) --&gt;
    &lt;meta name="apple-mobile-web-app-capable" content="yes"/&gt;
    &lt;!-- 是否启用 WebApp 全屏模式,删除苹果默认的工具栏和菜单栏 --&gt;

    &lt;meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"&gt;
    &lt;!-- 添加智能 App 广告条 Smart App Banner(iOS 6+ Safari) --&gt;
    &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"/&gt;
    &lt;!-- 设置苹果工具栏颜色 --&gt;
    &lt;meta name="format-detection" content="telphone=no, email=no"/&gt;
    &lt;!-- 忽略页面中的数字识别为电话,忽略email识别 --&gt;
    &lt;!-- 启用360浏览器的极速模式(webkit) --&gt;
    &lt;meta name="renderer" content="webkit"&gt;
    &lt;!-- 避免IE使用兼容模式 --&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;!-- 不让百度转码 --&gt;
    &lt;meta http-equiv="Cache-Control" content="no-siteapp" /&gt;
    &lt;!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 --&gt;
    &lt;meta name="HandheldFriendly" content="true"&gt;
    &lt;!-- 微软的老式浏览器 --&gt;
    &lt;meta name="MobileOptimized" content="320"&gt;
    &lt;!-- uc强制竖屏 --&gt;
    &lt;meta name="screen-orientation" content="portrait"&gt;
    &lt;!-- QQ强制竖屏 --&gt;
    &lt;meta name="x5-orientation" content="portrait"&gt;
    &lt;!-- UC强制全屏 --&gt;
    &lt;meta name="full-screen" content="yes"&gt;
    &lt;!-- QQ强制全屏 --&gt;
    &lt;meta name="x5-fullscreen" content="true"&gt;
    &lt;!-- UC应用模式 --&gt;
    &lt;meta name="browsermode" content="application"&gt;
    &lt;!-- QQ应用模式 --&gt;
    &lt;meta name="x5-page-mode" content="app"&gt;
    &lt;!-- windows phone 点击无高光 --&gt;
    &lt;meta name="msapplication-tap-highlight" content="no"&gt;
    &lt;!-- iOS 图标 begin --&gt;
    &lt;link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/&gt;
    &lt;!-- iPhone 和 iTouch,默认 57x57 像素,必须有 --&gt;
    &lt;link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/&gt;
    &lt;!-- Retina iPhone 和 Retina iTouch,114x114 像素,可以没有,但推荐有 --&gt;
    &lt;link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png"/&gt;
    &lt;!-- Retina iPad,144x144 像素,可以没有,但推荐有 --&gt;
    &lt;!-- iOS 图标 end --&gt;

    &lt;!-- iOS 启动画面 begin --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="768x1004" href="/splash-screen-768x1004.png"/&gt;
    &lt;!-- iPad 竖屏 768 x 1004(标准分辨率) --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="1536x2008" href="/splash-screen-1536x2008.png"/&gt;
    &lt;!-- iPad 竖屏 1536x2008(Retina) --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="1024x748" href="/Default-Portrait-1024x748.png"/&gt;
    &lt;!-- iPad 横屏 1024x748(标准分辨率) --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="2048x1496" href="/splash-screen-2048x1496.png"/&gt;
    &lt;!-- iPad 横屏 2048x1496(Retina) --&gt;

    &lt;link rel="apple-touch-startup-image" href="/splash-screen-320x480.png"/&gt;
    &lt;!-- iPhone/iPod Touch 竖屏 320x480 (标准分辨率) --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="640x960" href="/splash-screen-640x960.png"/&gt;
    &lt;!-- iPhone/iPod Touch 竖屏 640x960 (Retina) --&gt;
    &lt;link rel="apple-touch-startup-image" sizes="640x1136" href="/splash-screen-640x1136.png"/&gt;
    &lt;!-- iPhone 5/iPod Touch 5 竖屏 640x1136 (Retina) --&gt;
    &lt;!-- iOS 启动画面 end --&gt;

    &lt;!-- iOS 设备 end --&gt;
    &lt;meta name="msapplication-TileColor" content="#000"/&gt;
    &lt;!-- Windows 8 磁贴颜色 --&gt;
    &lt;meta name="msapplication-TileImage" content="icon.png"/&gt;
    &lt;!-- Windows 8 磁贴图标 --&gt;

    &lt;link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/&gt;
    &lt;!-- 添加 RSS 订阅 --&gt;
    &lt;link rel="shortcut icon" type="image/ico" href="/favicon.ico"/&gt;
    &lt;!-- 添加 favicon icon --&gt;

    &lt;!-- sns 社交标签 begin --&gt;
    &lt;!-- 参考微博API --&gt;
    &lt;meta property="og:type" content="类型" /&gt;
    &lt;meta property="og:url" content="URL地址" /&gt;
    &lt;meta property="og:title" content="标题" /&gt;
    &lt;meta property="og:image" content="图片" /&gt;
    &lt;meta property="og:description" content="描述" /&gt;
    &lt;!-- sns 社交标签 end --&gt;

    &lt;title&gt;标题&lt;/title&gt;
&lt;/head&gt;<br>&lt;/html&gt;</pre><br><br>
来源:https://www.cnblogs.com/FACESCORE/p/11141653.html
頁: [1]
查看完整版本: HTML5 meta 属性整理