zoukankan      html  css  js  c++  java
  • HTML 之 Meta

    前言

    html中的meta标签用于提供页面相关的元信息。以键值对的形式定义。出现在head标签之间。

    meta标签具有以下几个属性:

    content(必须): 与name属性对应,标识元信息的值。

    name: 标识元信息的名称。

    http-equiv: 将content属性关联到http头部,指示服务器在发送文档给浏览器之前在http头部加入相关的键值对。

    scheme: 定义用于翻译content属性值的格式。

    注:html文档的meta标签不需要结束标签,而xhtml必须正确地关闭标签。

    常见meta标签

    1.<meta http-equiv="X-UA-Compatible" content="IE=7" >

    IE8新增的一个属性(IE8以下浏览器不识别不起作用),用于指定页面的渲染模式。该属性必须定义在head标签内除了title和其他meta标签之外的所有标签之前。

    <meta http-equiv="X-UA-Compatible" content="IE=7" > // 告诉IE浏览器使用IE7引擎渲染。

    <meta http-equiv="X-UA-Compatible" content="IE=edge" > // 告诉IE浏览器使用最高版本的IE引擎渲染。

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > // 告诉IE浏览器使用最高版本的IE引擎渲染,激活Google Chrome Frame.

    Google Chrome Frame(GCF,谷歌内嵌浏览器框架): 可用于内嵌于IE浏览器,用户使用IE浏览器,但实际上是使用chrome引擎来渲染页面。 

    因此,上面的定义可以理解为:当用户使用IE浏览器访问网页时,如果浏览器安装了GCF,则使用Chrome的引擎来渲染页面,否则使用最高版本的IE引擎来渲染页面。

    2.<meta charset="utf-8" >

    指定页面的字符编码。

    3.<meta name="renderer" content="webkit" >

    用于指定浏览器内核,例如webkit,ie-comp,ie-stand...详细

    4.<meta name="keywords" content="keyword1,keyword2,keyword3" >

    用于描述介绍网站的关键词,主要是提供给搜索引擎优化。

    5.<meta name="description" content="few sentences" >

    简单的几句话用于网站页面简介。首页一般是描述整个网站的简介,内容页一般是内容的摘要。

    6.<meta http-equiv="Cache-Control" content="max-age=7200" />

    //

    7.<meta name="viewport" content="width=device-width, initial-scale=1.0">

    详细

    8.<meta name="author" content="">

    指明网页的作者。

    9.<meta name="robots" content="noindex,nofollow">

    定义搜索引擎的索引方式。

    index 告诉搜索引擎索引此页面。

    follow 告诉搜索引擎根据此页面链接去索引其他页面。

    noindex 告诉搜索引擎不要索引此页面。

    nofollow 告诉搜索引擎不要根据此页面链接去索引其他页面。

    none 告诉搜索引擎忽略此页面,相当于 noindex,nofollow.

    all 相当于 index,follow.

    如果不提供此属性,默认为all.

    10.<meta name="meta-apple-mobile-web-app-status-bar-style" content="default">

    指定状态栏的样式(颜色)。

    11.<meta name="apple-mobile-web-app-capable" content="no">

    启动IOS Safari时页面是否进入全屏状态。

    12.<meta http-equiv="Content-Language" content="en">

    将该属性添加到http头部返回给浏览器。

    13.<meta name="copyright" content="your website copyright">

    指明网页的版本所有。

    14.<meta name="language" content="language">

    指明网页使用的语言。

    15.<meta name="revised" content="revised date">

    指明网页的修订时间。

    参考

    http://www.zuojj.com/archives/1242.html 

  • 相关阅读:
    java.lang.NoSuchMethodError
    asm相关内容想下载(包括 jar 包)
    Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type
    用Navicat连接mysql报错:2003-Can't connect to MySql server on '10.100.0.109'(10039)
    The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files
    The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
    交通测速方式
    卡口和电子警察的区别
    Myeclipse连接Mysql数据库时报错:Error while performing database login with the pro driver:unable
    在window上安装mysql
  • 原文地址:https://www.cnblogs.com/hisheng/p/6194095.html
Copyright © 2011-2022 走看看