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 tag interval; 2. By adding "while (i --){document.createElement(e[i])}" code implementation supports HTML5 elements.
#The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
Does ie8 support html5?
No.
But to make IE (ie6/ie7/ie8) support HTML5 elements, we can add the following JavaScript to the HTML header. This is a simple document.createElement statement, using conditional comments to call this js file for IE. . Opera, FireFox and other non-IE browsers will ignore this code and there will be no http request.
Method 1: Quote Google’s html5.js file. You can download the code content and read it yourself.
<!–[if lt IE9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]–>
Put the above code into the head tag interval
Method 2: Do it by coding JS yourself.
<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 of the above methods you use, please remember to define the following in CSS to make these tags become block elements, just like divs.
/*html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}
Recommended learning: "HTML5 Video Tutorial"
The above is the detailed content of Does ie8 support html5?. For more information, please follow other related articles on the PHP Chinese website!