热门关键字:
jquery > jquery教程 > html5 > html5技巧之让IE支持html5

html5技巧之让IE支持html5

1199
作者:管理员
发布时间:2015/7/19 15:00:31
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=688
html5技巧之让IE支持html5
html5技巧之让IE支持html5
IE9以下版本的浏览器目前对html5的支持并不好,也是阻碍html5的更快普及的一大绊脚石,不过,IE9对html5的支持度还是很不错的。


IE把html5新增的标签都解析成内联元素,而实际上它们是块级元素,所以有必要为它们定义一个样式:

article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary {
   display: block;
}

尽管如此,IE还是不能解析这些新增的html5标签,以下两种方法可以解决:
1、借助Javascript来解决这个问题:
document.createElement("article");
document.createElement("footer");
document.createElement("header");
document.createElement("hgroup");
document.createElement("nav");
document.createElement("menu");
document.createElement("aside");
document.createElement("details");
document.createElement("figcaption");
document.createElement("figure");
document.createElement("main");
document.createElement("section");
document.createElement("summary");


2、引入插件来修复IE更好的解析html5
<script mce_src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:html5 article aside details figcaption figure footer header hgroup main menu nav section summary
友荐云推荐