支持IE8与HTML5 [英] Supporting IE8 with HTML5

查看:170
本文介绍了支持IE8与HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我在几年前工作的一些网站现在在IE8中损坏了。花了一段时间才发现,但我看到了文件 - http://html5shim.googlecode。 com / svn / trunk / html5.js - 我一直使用的是离线的。

I've noticed that some websites I worked on years ago are now broken in IE8. It took a while to figure out but I see the file — http://html5shim.googlecode.com/svn/trunk/html5.js — that I've always used is now offline.

我经常不建立网站这些天,所以我有点不接触。但是devs基本上放弃了这个浏览器吗?

I don't often build websites these days so I'm a little out of touch. But have devs basically abandoned this browser now? or is there some other alternative file to fix it?

推荐答案

如果你只是想在IE8中使用HTML5元素,基本样式,您只需要这个

If you just want to use HTML5 elements in IE8, for basic styling, you only need this

CSS

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

JS(在载入时运行)

JS (run on load)

(function(d) {
  var e = 'article aside details figcaption figure footer header main mark menu nav section summary'.split(' '),i=e.length;
  while(i--) { d.createElement(e[i]); }
})(document);







Side note:

对于IE9,实际上需要这个(如果不使用任何库,因为它们通常已经这样)。

For IE9 one actually need this (if not use any library, as they normally does this already)

CSS

main { display:block; }

这篇关于支持IE8与HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆