IE (IE6/IE7/IE8) supports HTML5 tags

Source: Internet
Author: User
Tags html header

To enable IE (IE6/IE7/IE8) to support HTML5 elements, we need to add the following Javascript in the HTML header, which is a simple document. createelement declaration. This JS file is called for IE using conditional annotations. Opera, Firefox, and other non-ie browsers will ignore this code and there will be no HTTP requests.

 

Method 1: Reference Google's html5.js File,Place the code in the head label range,The Code content can be downloaded and viewed by yourself.

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

 

Method 2: handle it by yourself using coding Js.

<!–[if IE]><script>(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(’,'),i=e.length;while(i–){document.createElement(e[i])}})()</script><![endif]–>

  

No matter which method you use, please remember to define the following in CSS to make these labels become block elements, just like Div.

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

  

 

 

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.