让低版本ie浏览器(ie9及以下版本)支持HTML5标签,我们需要在HTML的head标签区间引用html5.js文件。文件可以百度或者谷歌搜索下载。
必须注意的是html5.js文件必须添加在页面的head标签之间,因为浏览器必须在元素解析前知道这个元素。
当然我们也可以自己写一段代码来实现低版本ie浏览器对html5标签的支持,代码如下
(function() {
if (!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])
}
})()
最后记得CSS中添加以下代码,将这些html5标签初始成块状哦
abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video {display:block}