zoukankan      html  css  js  c++  java
  • 解决IE9以下ie版本不能识别新元素的方法 添加一个js -- Shiv Solution

    Thankfully, Sjoerd Visscher created the "HTML5 Enabling JavaScript", "the shiv":

    <!--[if lt IE 9]>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.js"></script>
    <![endif]-->

    The code above is a comment, but versions previous to IE9 will read it (and understand it).

    Adding New Elements to HTML

    You can add any new element to HTML with a browser trick:

    This example adds a new element called <myHero> to HTML, and defines a display style for it:

    <!DOCTYPE html>
    <html>
    <head>
      <title>Creating an HTML Element</title>
      <script>document.createElement("myHero")</script>
      <style>
      myHero {
          display: block;
         
          padding: 50px;
          font-size: 30px;
      } 
      </style

    <!--[if lt IE 9]>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.js"></script>
    <![endif]-->
    </head>
    <body>

    <h1>My First Heading</h1>

    <p>My first paragraph.</p>

    <myHero>My First Hero</myHero>

    </body>
    </html>

  • 相关阅读:
    札记:计算机网络篇:物理层
    vs2012 它已停止工作
    php laravel 帧 该文件上传
    2016第一周日
    2015年第1周六
    2016第1周五优化自己
    2016值得关注的语言平台、JS框架
    JS模块化规范CommonJS,AMD,CMD
    2016第1周二
    ReactJS入门教程
  • 原文地址:https://www.cnblogs.com/facial/p/4494184.html
Copyright © 2011-2022 走看看