Html HTML5shiv vs Dean Edwards IE7-js vs Modernizr - 选择哪个?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3855294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:44:53  来源:igfitidea点击:

HTML5shiv vs Dean Edwards IE7-js vs Modernizr - which to choose?

htmlmodernizr

提问by PaulM

I'm looking to build my first HTML5 site and have been looking at working with IE.

我希望建立我的第一个 HTML5 站点,并且一直在考虑使用 IE。

There is html5shiv, Dean Edwards ie7-js and then Modernizr. Are these all largely the same? I'm confused about which route to go.

有 html5shiv、Dean Edwards ie7-js 和 Modernizr。这些都大体相同吗?我对走哪条路感到困惑。

回答by Spudley

No, they're not the same at all; they do completely different things.

不,它们根本不一样。他们做完全不同的事情。

  • html5shivallows you to use the new HTML5 tags in versions of IE that don't understand them. Without it, IE will choke on these tags, so you need this if you intend to use the tags. Don't expect it to make the tags actually do anything in IE though! It just stop the browser complaining about them.

  • modernizrsets a bunch of classes in your HTML, depending on the available features, which you can use to change your layout according to what the browser supports. It also allows you to use the new HTML5 tags in IE, like html5shiv.

  • ie7.js(as well as ie8.jsand ie9.js) uses Javascript to retro-fit some missing functionality to IE.

  • html5shiv允许您在不理解它们的 IE 版本中使用新的 HTML5 标签。没有它,IE 会被这些标签卡住,所以如果你打算使用这些标签,你就需要这个。不要指望它使标签实际上在 IE 中做任何事情!它只是阻止浏览器抱怨它们。

  • Modernizr根据可用功能在 HTML 中设置了一堆类,您可以使用这些功能根据浏览器支持的内容更改布局。它还允许您在 IE 中使用新的 HTML5 标签,如 html5shiv。

  • ie7.js(以及ie8.jsie9.js)使用 Javascript 将一些缺失的功能改造为IE。

As far as I'm aware there's no cross-over between them (aside from html5shiv/modernizr), so you can use any combination of them, depending on what features you need to implement.

据我所知,它们之间没有交叉(除了 html5shiv/modernizr),因此您可以使用它们的任意组合,具体取决于您需要实现的功能。

While I'm on the subject, and since you're asking about tools to make IE more compatible with other browsers, I suggest you also look into CSS3Pie, which will make your life much happier if you plan to use rounded corners on your site (plus one or two other features).

当我在谈论这个主题时,并且由于您询问的是使 IE 与其他浏览器更兼容的工具,我建议您也查看CSS3Pie,如果您打算在您的网站上使用圆角,它会让您的生活更加快乐(加上一两个其他功能)。

This also has no cross-over with the other three products you mentioned, though they do all aim to make old versions of IE slightly easier to work with.

这也与您提到的其他三个产品没有交叉,尽管它们都旨在使旧版本的 IE 更易于使用。

回答by ZOZ

Easiest way to start a new HTML5 project is using initializr. It will guide and let you build, download your HTML5 project files.

启动新 HTML5 项目的最简单方法是使用initializr。它将指导并让您构建、下载 HTML5 项目文件。

回答by FatherStorm

they are somewhat the same, and which way to go is ATM as good a guess either way, and for the record, there's one you missed, http://html5boilerplate.com/This is sort of a repeat of some years ago when prototype and jQuery were fighting in the same space. I'd personally hazard that jQuery won but for now there's no telling which one of these will win this particular fight. I don't think I could recommend dean edwards ie7-js as it mostly deals with just getting IE7 to act like other more intelligent and likable browsers as opposed to leveraging the whole HTML5 thing as much as the other frameworks.

它们有些相同,无论哪种方式,ATM 都可以很好地猜测,并且为了记录,您错过了一个, http://html5boilerplate.com/这是几年前原型的重复和 jQuery 在同一个空间中战斗。我个人认为 jQuery 赢了,但目前还不清楚其中哪一个会赢得这场特殊的战斗。我不认为我可以推荐 dean edwards ie7-js,因为它主要处理让 IE7 像其他更智能、更受欢迎的浏览器一样工作,而不是像其他框架一样利用整个 HTML5 东西。