码迷,mamicode.com
首页 > Web开发 > 详细

【hack】ie8如何兼容html5标签

时间:2017-11-03 20:16:56      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:turn   cti   section   code   log   audio   asi   nbsp   size   

ie8是识别不了html5语义化标签的,解决方法:

在头部文件的<head></head>里面下如下代码    (这段代码的意思是如果ie版本低于ie8,就创建所有HTML5新标签

 

<!--[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]-->

另外,在公共样式文件中添加html5标签的块定义
article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}


由上俩步即实现ie8中html5标签的识别。
 

【hack】ie8如何兼容html5标签

标签:turn   cti   section   code   log   audio   asi   nbsp   size   

原文地址:http://www.cnblogs.com/smilexumu/p/7779666.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!