關於ie9以下瀏覽器不支援html5元素
阿新 • • 發佈:2018-12-12
ie9以下的瀏覽器都不能支援html5標籤(article,aside,dialog,footer,header,section,footer,nav,figure,menu)。
方法一:
!--[if lt IE9]> <script> (function() { if (!/*@[email protected]*/ 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> <![endif]-->
方法二:
<!--[if lt IE9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
/*html5*/article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}