我找到的网上的解决方法是在head标签里加入html5shiv的谷歌引用,地址以下:html
<!--[if IE]> <script src=”http://html5shiv.googlecode.com/svn/trunk/html5.js”></script> < ![endif]-->html5
注意:将上代码复制到head部分,记住必定要是head部分(由于IE必须在元素解析前知道这个元素,因此这个js文件不能在其余位置调用,不然失效)canvas
不要忘了给这些自定义的标签添加block属性:
/*html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}
可是,网上给的这个连接方法在虚拟机上用ietester实验发现没有成功,也就是没能下载到这个js连接浏览器
因此,上面写的不成功,我决定把代码拿出来贴在head里或者本身本地写个html5.js,就像这样:ide
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<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(','),i=e.length;while(i--){document.createElement(e[i])}})()
</script>
<style>
/*html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}
section{color: red}
</style>
</head>
<body>
<section>试验下</section>
</body>
</html>
而后通过试验ietest各类版本均可以,红色代码主要是利用document.createElement为浏览器添加新的标签以及设置为block属性,查阅了下ppk的网站,document.createElement全部浏览器都支持,注意添加的位置