Home >Web Front-end >Front-end Q&A >Does ie8 support html5?

Does ie8 support html5?

藏色散人
藏色散人Original
2023-01-06 15:31:012688browse

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.

Does ie8 support html5?

#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(&#39;, &#39;);
     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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn