IE (IE6/IE7/IE8) supports HTML5 tags -- 20150216, html5 -- 20150216

Source: Internet
Author: User
Tags html header

IE (IE6/IE7/IE8) supports HTML5 tags -- 20150216, html5 -- 20150216

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 the html5.js file of google. You can download and view the code content on your own.

  <! -[If lt IE9]>
<Script src ="
Http://html5shiv.googlecode.com/svn/trunk/html5.js> </script>
<! [Endif]->

Place the above Code in the head label range

  Method 2: handle it by yourself using coding JS.

<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 (',');
Var I = e. length;
While (I --){
Document. createElement (e [I])
}
})()
</Script>

  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}

Related Article

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.