完美解决IE(IE6/IE7/IE8)不兼容HTML5标签的方法

方式一:Coding JavaScript

<!--[if lt IE9]> 
<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>
<![endif]-->

另外一种方法:使用Google的html5shiv包(推荐)

<!--[if lt IE9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

可是无论使用以上哪种方法,都要初始化新标签的CSS.由于HTML5在默认情况下表现为内联元素,对这些元素进行布局我们须要利用CSS手工把它们转为块状元素方便布局
/*html5*/
article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}

原文转自:http://www.cnblogs.com/Capricornus/archive/2013/03/26/2982122.html

原文地址:https://www.cnblogs.com/yutingliuyl/p/6950143.html