The browser does not support HTML5 or html5.
Some browsers do not support new elements in HTML5, such as IE8 or earlier versions. To apply a style, add the following JavaScript code to the header tag
1
The focus is document. createElement. Considering the compatibility of different browsers, You can optimize the above JS Code, that is, using conditional statements to include JS Code
IE9 or earlier versions of IE will create HTML5 labels. Non-IE browsers will ignore this code, so there will be no http requests, and the webpage execution efficiency will not be affected.
1 <script> 2 (function() { 3 if (! 4 /*@cc_on!@*/ 5 0) return; 6 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(', '); 7 var i= e.length; 8 while (i--){ 9 document.createElement(e[i])10 }11 })()12 </script>
Add this section in css:
/* Html5 */article, aside, dialog, footer, header, section, footer, nav, figure, menu {display: block}
These html5 labels are mainly made into blocks, like div.
Another way for IE to identify new elements is to use HTML5 shiv. html5shiv is very easy to use. Introduce Google's html5shiv package to Your webpage (you can directly call it after writing it) in the page head.
1 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
Must be added to
: Http://html5shiv.googlecode.com/svn/trunk/html5.js