zoukankan      html  css  js  c++  java
  • IE(IE6/IE7/IE8)支持HTML5标签

    让IE(ie6/ie7/ie8)支持HTML5元素,我们需要在HTML头部添加以下JavaScript,这是一个简单的document.createElement声明,利用条件注释针对IE来调用这个js文件。Opera,FireFox等其他非IE浏览器就会忽视这段代码,也不会存在http请求。

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

    方式二:自己coding JS搞定。

       (function() {
         if (! 
         /*@cc_on!@*/
         0) return;
         var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video".split(', ');
         var i= e.length;
         while (i--){
             document.createElement(e[i])
         } 
    })() 

    不管你用上面哪中方式,请记得在CSS中进行如下定义,目的是让这些标签成为块状元素,just like div。

    /*html5*/
    article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}

    <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
    <!--[if IE]> 所有的IE可识别 <![endif]-->
    <!--[if IE 6]> 仅IE6可识别 <![endif]-->
    <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
    <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
    <!--[if IE 7]> 仅IE7可识别 <![endif]-->
    <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
    <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
    <!--[if IE 8]> 仅IE8可识别 <![endif]-->
    <!--[if IE 9]> 仅IE9可识别 <![endif]-->

    html5.js

  • 相关阅读:
    ActiveForm
    phpstudy配置虚拟主机
    PHP 二分查找
    mysql group by 用法解析(详细)
    Linux(CentOS)下的apache服务器配置与管理
    ubuntu server sudo出现sudo:must be setuid root 完美解决办法
    VB连接MYSQL数据的方法
    mysql 远程登录及常用命令
    在eclipse上搭建Roku开发环境
    linux ps查进程 kill关闭进程
  • 原文地址:https://www.cnblogs.com/yeminglong/p/4413737.html
Copyright © 2011-2022 走看看