Most people do not understand the knowledge points of this ie8 support article that does not support html5, so the editor summarizes the following content for everyone. The content is detailed, the steps are clear, and it has a certain reference value. I hope you can finish reading this article The article can gain something, let's take a look at this article that ie8 does not support html5.
IE8 does not support html5, if you want ie8 to support html5, there are two ways: 1. Reference google's html5.js file and put the code in the head Label interval; 2. Support HTML5 elements by adding while (i--){document.createElement(e[i])} code.
But let IE (ie6/ie7/ie8) support HTML5 elements, we can add the following JavaScript in the HTML head, this is a simple document.createElement statement, using conditional comments for IE to call this js file. Opera, FireFox and other non-IE browsers will ignore this code, and there will be no http request.
Method 1: Refer to Google's html5.js file, and 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]–>
Put the above code into the head tag area
Method 2: Do it yourself with 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 above, please remember to define the following in CSS, the purpose is to make these tags become block elements, just like div.
/*html5*/article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}
Copyright Description:No reproduction without permission。
Knowledge sharing community for developers。
Let more developers benefit from it。
Help developers share knowledge through the Internet。
Follow us
2023-03-13
2023-03-13