zoukankan      html  css  js  c++  java
  • <meta>标签详解

    一、<meta>标签的定义和用法

    <meta> 元素可提供有关页面的元信息(meta-information),位于文档的头部<head>和</head>之间,不包含任何内容。<meta> 标签的属性定义了与文档相关联的名称/值对。

    二、<meta>标签的属性

     1.必要属性

    属性描述
    content some_text 定义与 http-equiv 或 name 属性相关的元信息

    2.可选属性

    属性描述
    http-equiv

    content-type

    expires

    refresh

    set-cookie

    把 content 属性关联到 HTTP 头部。
    name

    author

    description

    keywords

    generator

    revised

    others

    把 content 属性关联到一个名称。
    scheme some_text 定义用于翻译 content 属性值的格式。

    三、常用的<meta>标签 

      <!-- 声明文档使用的字符编码 -->
        <meta charset='utf-8'>
    
        <!-- 优先使用 IE 最新版本和 Chrome -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    
      <!-- 关于X-UA-Compatible -->
      <meta http-equiv="X-UA-Compatible" content="IE=6" ><!-- 使用IE6 -->
      <meta http-equiv="X-UA-Compatible" content="IE=7" ><!-- 使用IE7 -->
      <meta http-equiv="X-UA-Compatible" content="IE=8" ><!-- 使用IE8 -->
    
        <!-- 页面描述 -->
        <meta name="description" content="不超过150个字符"/>
    
        <!-- 页面关键词 -->
        <meta name="keywords" content=""/>
    
        <!-- 网页作者 -->
        <meta name="author" content="name, email@gmail.com"/>
    
        <!-- 搜索引擎抓取 -->
        <meta name="robots" content="index,follow"/>
    
        <!-- 为移动设备添加 viewport -->
        <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    
        <!-- 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"/>
    
            <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
            <meta name="format-detection" content="telphone=no, email=no"/>
    
            <!-- 启用360浏览器的极速模式(webkit) -->
            <meta name="renderer" content="webkit">
    
            <!-- 避免IE使用兼容模式 -->
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
            <!-- 不让百度转码 -->
            <meta http-equiv="Cache-Control" content="no-siteapp" />
    
            <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
            <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">
    
    
            <!-- 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 -->
    
        <!-- Windows 8 磁贴颜色 -->
        <meta name="msapplication-TileColor" content="#000"/>
    
        <!-- Windows 8 磁贴图标 -->
        <meta name="msapplication-TileImage" content="icon.png"/>
    
        <!-- 添加 RSS 订阅 -->
        <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/>
    
        <!-- 添加 favicon icon -->
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
    
        <!-- 关闭chrome浏览器下的翻译插件 -->
        <meta name="google" value="notranslate" />
    
        <!-- sns 社交标签 begin -->
            <!-- 参考微博API -->
            <meta property="og:type" content="类型" />
            <meta property="og:url" content="URL地址" />
            <meta property="og:title" content="标题" />
            <meta property="og:image" content="图片" />
            <meta property="og:description" content="描述" />
        <!-- sns 社交标签 end -->
    
      <!-- iOS中Safari允许全屏浏览 -->
      <meta content="yes" name="apple-mobile-web-app-capable">
    
      <!-- ios中Safari顶端状态条样式 -->
      <meta content="black" name="apple-mobile-web-app-status-bar-style">
    
      <!-- IOS中Safari设置保存到桌面图标-->
      <link rel="apple-touch-icon" href="custom_icon.png">
    
      <!-- 指定了HTML页面使用的字符编码为gb2312-->
      <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    
      <!--让网页在指定的5秒内,跳转到所指定的页面-->
      <meta http-equiv="Refresh" content="5; url=http://www.cnblogs.com" />
    
      <!--设定网页的到期时间,一旦过期必须到服务器上重新调用(GMT时间格式)-->
      <meta http-equiv="Expires" content="Mon,1,May 2015 00:00:00 GMT" />
    
      <!--禁止浏览器从本地机的缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出-->
      <meta http-equiv="Pragma" content="no-cache" />
    
      <!--网页等级的评定-->
      <meta http-equiv="Pics-label" content="" />
    
      <!--强制页面在当前窗口中以独立页面显示,防止自己的网页被别人当成一个frame调用。Content选项:_blank、_top、_self、_parent-->
      <meta http-equiv="windows-Target" content="_top" />
    
      <!--页面被载入和调出时的一些特效-->
      <Meta http-equiv="Page-Enter" Content="revealTrans(Duration=0.5,tansition=10" />
      <Meta http-equiv="Page-Exit" Content="revealTrans(Duration=0.5,transition=12" />
    
      <!--禁止浏览器从本地计算机的缓存中访问页面内容,无法脱机浏览-->
      <meta http-equiv="Pragma" content="no-cache">
    
      <!--用百度打开网页可能会对其进行转码(比如贴广告),避免转码可添加如下meta-->
      <meta http-equiv="Cache-Control" content="no-siteapp" />

     

  • 相关阅读:
    【转】关于GRIB数据的处理
    [转载]国际gis遥感杂志
    【转】linux后台运行和关闭、查看后台任务
    OpenXML: excel 插入BarChart图表
    利用.Net Framework2.0 zip压缩、解压 string 数据
    C# 常见面试题(2)
    'String or binary data would be truncated' error message
    Openxml: 导出excel 设置 cell的格式
    OpenXML: Asp.net利用OpenXML 导出Excel.
    C#中文和UNICODE字符转换方法
  • 原文地址:https://www.cnblogs.com/ombre/p/7421941.html
Copyright © 2011-2022 走看看