html 常用 meta


meta是文档级元数据元素,一般放在整个html页面的head部分。

name 属性

namecontent 一起使用,前者表示要表示的元数据的名称,后者是元数据的

http-equiv 属性

http-equiv 也是和 content 一起使用,前者表示要表示的元数据的名称,后者是元数据的

http-equiv 所有允许的值都是特定 HTTP 头部的名称。

<head>
    <!-- 声明文档使用的字符编码 -->
    <meta charset='utf-8'>
    <!-- 页面内容的描述 -->
    <meta name="description" content="不超过150个字符"/>
    <!-- 页面关键词,使用逗号分隔。某些搜索引擎在遇到这些关键字时,会用这些关键字对文档进行分类 -->
    <meta name="keywords" content=""/>
    <!-- 网页作者 -->
    <meta name="author" content="name, email@gmail.com"/>
    <!-- 搜索引擎抓取行为 -->
    <meta name="robots" content="index,follow"/>
    <!-- 为移动设备添加 viewport。width 用来设置 viewport 的宽度为设备宽度 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- 忽略页面中的数字识别为电话,忽略email识别 -->
	<meta name="format-detection" content="telphone=no, email=no"/>
    <!-- 指定双核浏览器的渲染方式: webkit,默认webkit内核;ie-comp,默认IE兼容模式;ie-stand,默认IE标准模式-->
 	<meta name="renderer" content="webkit|ie-comp|ie-stand">

    <!-- IE浏览器适配:
        IE=edge告诉浏览器,以当前浏览器支持的最新版本来渲染。
        chrome=1告诉浏览器,如果当前IE浏览器安装了Google Chrome Frame插件,就以chrome内核来渲染页面。 
        像上图这种两者都存在的情况:如果有chrome插件,就以chrome内核渲染,如果没有,就以当前浏览器支持的最高版本渲染。
        该属性支持的范围是 IE8-IE11。
        如果在http头部也设置了这个属性,并且和meta中设置的有冲突,那么哪一个优先呢?答案是:开发者偏好(meta元素)优先于Web服务器设置(HTTP头)。
    -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<!-- 一般来说,HTML页面中的a标签会自动启用DNS提前解析来提升网站性能,但是在使用https协议的网站中失效了,我们可以设置:  -->
    <meta http-equiv="x-dns-prefetch-control" content="on"/>
    <!-- 设置语言  -->
  	<meta http-equiv="Content-Language" Content="zh-cn" /> 
	<!-- 设置重定向(15秒后页面自动跳转到百度)  -->
  	<meta http-equiv="Refresh" Content="15; Url=http://www.baidu.com" /> 
	<!-- 设置网页到期时间(一旦网页过期,必须到服务器上重新下载)   -->
 	<meta http-equiv="Expires" Content="Web, 26 Jun 2015 18:21:57 GMT" /> 
	<!-- 不使用缓存(禁止浏览器从本地计算机的缓存中访问页面内容)  -->
 	<meta http-equiv="Pragma" Content="No-cach" /> 
	<!-- 不让百度转码 -->
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <!-- 添加 RSS 订阅 -->
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/>
    <!-- Set-Cookie(cookie设定,如果网页过期,那么存盘的cookie将被删除) -->
    <meta http-equiv="Set-Cookie" content="cookie value=xxx; expires=Friday,12-Jan-200118:18:18GMT;path=/"> 
	
	<!-- iOS 设备 begin -->
	<!-- 添加到主屏后的标题(iOS 6 新增) -->
    <meta name="apple-mobile-web-app-title" content="标题">
    <!-- 是否启用 WebApp 全屏模式,删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <!-- 添加智能 App 广告条 Smart App Banner(iOS 6+ Safari) -->
    <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"/>
    <!-- 设置苹果工具栏颜色 -->
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <!-- 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"/>

    <!-- iOS 图标 begin -->
    <!-- iPhone 和 iTouch,默认 57x57 像素,必须有 -->
	<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/>
    <!-- Retina iPhone 和 Retina iTouch,114x114 像素,可以没有,但推荐有 -->
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/>
    <!-- Retina iPad,144x144 像素,可以没有,但推荐有 -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png"/>
    <!-- iOS 图标 end -->

    <!-- iOS 启动画面 begin -->
    <!-- iPad 竖屏 768 x 1004(标准分辨率) -->
    <link rel="apple-touch-startup-image" sizes="768x1004" href="/splash-screen-768x1004.png"/>
    <!-- iPad 竖屏 1536x2008(Retina) -->
    <link rel="apple-touch-startup-image" sizes="1536x2008" href="/splash-screen-1536x2008.png"/>
    <!-- iPad 横屏 1024x748(标准分辨率) -->
    <link rel="apple-touch-startup-image" sizes="1024x748" href="/Default-Portrait-1024x748.png"/>
    <!-- iPad 横屏 2048x1496(Retina) -->
    <link rel="apple-touch-startup-image" sizes="2048x1496" href="/splash-screen-2048x1496.png"/>
    <!-- iPhone/iPod Touch 竖屏 320x480 (标准分辨率) -->
    <link rel="apple-touch-startup-image" href="/splash-screen-320x480.png"/>
    <!-- iPhone/iPod Touch 竖屏 640x960 (Retina) -->
    <link rel="apple-touch-startup-image" sizes="640x960" href="/splash-screen-640x960.png"/>
    <!-- iPhone 5/iPod Touch 5 竖屏 640x1136 (Retina) -->
    <link rel="apple-touch-startup-image" sizes="640x1136" href="/splash-screen-640x1136.png"/>
    <!-- iOS 启动画面 end -->
    <!-- iOS 设备 end -->
</head>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值