zoukankan      html  css  js  c++  java
  • html5shiv

    https://github.com/hgonlywj/html5shiv

    <!-–[if lt IE 9]--><script src=" http://html5shiv.googlecode.com/svn/trunk/html5.js "></script ><!--[endif]–- > 

     

    IE 无法渲染 HTML5 样式

    http://intertwingly.net/blog/2008/01/22/Best-Standards-Support#c1201006277

    Chris Wilson: If you (the page developer) really want the best standards support IE8 can give, you can get it by inserting a simple <meta> element. Aaron gives more details on this in his article.

    Aaron Gustafson: This option, though strongly discouraged, will cause a site to target the latest IE browser versions as they release.

    My basic problem is that I don’t know what features are in and out of IE8 or when it will be released.  I don’t even have access to a simple screenshot.

    I simply want to code to standards, and hope that Microsoft will keep up as best of their ability.  Accordingly, I’ve implemented the following in my .htaccess file:

    BrowserMatch MSIE best-standards-support

    Header set X-UA-Compatible IE=edge env=best-standards-support

    See also: loose couplinghttps://en.wikipedia.org/wiki/Loose_coupling

     

     HTML5 Shiv使用

      html5.js 必须在页面head元素内调用(因为 IE 必须在元素解析前知道这个元素,所以这个 JS 文件不能在页面底部调用。)

      作者已经把js文件放在Google code project上并允许大家直接调用:http://html5shiv.googlecode.com/svn/trunk/html5.js

      可以使用IE条件注释来调用这个 JS 文件,这样像 FireFox, Safari 等非 IE 浏览器就会忽视这段代码,也就不会有无谓的 HTTP 请求了。下面这段代码仅会在IE浏览器下运行:

    <!–[if IE]>

    <script src=”http://html5shiv.googlecode.com/svn/trunk/html5.js”></script>

    <![endif]–>

     

      IE 对 HTML5 标签无法识别,所以无法渲染样式,有一种方法可以强制 IE 渲染 HTML5 标签,当你创建一个新的 DOM 元素(名字和它无法识别的标签相同)的时候,IE 就可以渲染,并且甚至无需插入这个元素,下面 flagLable

    <html> 
    <head> 
    <style>falgLable { color: blue; }</style> 
    <script>document.createElement("falgLable")</script> 
    </head> 
    <body> 
    <falgLable>Hello world!</falgLable> 
    </body> 
    </html>
    

      

    就能被渲染。

     

     

     

     

  • 相关阅读:
    docker的核心概念、docker的安装与卸载
    centos 7 配置yum源
    杂记
    linux命令之rpm(软件的安装卸载)
    chrony服务及cobbler+pxe实现自动化装机
    sshd登录控制脚及本sudo权限设置
    selinux控制脚本、AWK应用、监控访问脚本实例
    排除GC引起的CPU飙高
    POI报表导入导出
    逆向学习之环境准备
  • 原文地址:https://www.cnblogs.com/hgonlywj/p/4844771.html
Copyright © 2011-2022 走看看