Allow IE browser to support HTML5 new label resolution (using HTML5SHIV)

Source: Internet
Author: User

No mistake. Old browsers are not aware of these new tags so all are used in line elements to solve the problem, so, there is a solution to the breakthrough is to make it a block element will not be in the same row, so that the old and new browsers can show the same effect, and the browser to identify the tag, New tags are required, the specific solution is:
IE8/IE7/IE6 supports tags generated through the Document.createelement method, which allows these browsers to support HTML5 new tags, as follows:
Document.createelement (' new label '); //Add new tag creation

Way One: Coding JavaScript

<! -- [ifltIE9]>
<script>
   (function() {
     if (!
     /*@[email protected]*/
     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])
     }
})()
</Script>
<! [endif]->

Copy the code to the Head section, and remember that the head section must be (because IE has to know the element before parsing the element, so the JS file cannot be called elsewhere, otherwise it will fail)


Way two: Using Google's Html5shiv package (recommended)

<! -- [ifltIE9]>
<scriptsrc= "http://Html5shiv. Googlecode. com/svn/trunk/HTML5. js"></script>
<! [endif] -->

Of course, you can also take the code out of your own eyes:

(function() {
if (!/*@[email protected]*/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 (', '), I=e.length;
 while (i--) {document.createelement (E[i])
}})()

Finally add this paragraph to the CSS:
/*html5*/ article,aside,dialog,footer,header,section,Footer ,nav,figure,menu{display:block}
The main thing is to make these HTML5 tags into chunks, like Div.

OK, simple, a word summed up is: reference html5.js make HTML5 tag into chunks.

--------------------------------

Refer to Lei Feng Network source code example:

< reference: http://blog.csdn.net/ptyzhu/article/details/19477695 & http://www.th7.cn/web/html-css/201404/29228.shtml>

Allow IE browser to support HTML5 new label resolution (using HTML5SHIV)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.