Modernizr、html5shiv、ie7.js 和 CSS3 Pie。使用哪个以及何时使用?

发布于 2024-11-01 08:22:03 字数 380 浏览 1 评论 0原文

我刚刚开始在我的文档中使用 HTML5 和 CSS3。 我了解 JavaScript 需要让 Internet Explorer 跟上这些新标签和样式的速度,但我不知道该使用哪个以及何时使用!

我的计划是使用 html5shiv 和 IE9.js 来处理 HTML5 标签以及透明 png(以及它们修复的任何其他讨厌的错误),但后来 Modernizr 和 CSS3 Pie 引起了我的注意。

我的问题是,如果我使用 Modernizr,它是否能满足我对 html5shiv 和 IE9.js 的需求?或者我也应该包括这些?如果有的话,重叠是什么?

CSS3 Pie 做了哪些 Modernizr 或其他人没有做的事情?或者反之亦然?

我很感谢你们的帮助。让我知道你在做什么!?

I'm just starting to use HTML5 and CSS3 in my documents.
I understand the need for JavaScript to bring Internet Explorer up to speed with these new tags and styles, but I don't know which to use and when!

My plan was to use html5shiv and IE9.js to look after the HTML5 tags as well as the transparent pngs (and whatever other pesky errors they fix) but then Modernizr and CSS3 Pie were brought to my attention.

My question is, if I use Modernizr, does it look after my need for html5shiv as well as IE9.js? Or should I include these as well? What is the overlap, if any?

And what does CSS3 Pie do that Modernizr or the others doesn't? Or vice versa?

I appreciate your guys help. Let me know what you do!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

溇涏 2024-11-08 08:22:03

我对所有这些都拥有丰富的经验,并且每个都使用了几年。

Modernizr

包含 HTML5shiv 功能
还可以做更多的事情 - 如果您不使用其他功能,那就不要使用它,它确实会减慢页面加载速度,但如果您需要它,这是值得的!

HTML5shiv

非常小,只是修复了 IE 中的 html5 元素,没有其他内容。

CSS3PIE

允许您在旧版本的 IE 中使用边框半径、渐变和框阴影。还可以在 IE 6 中允许 PNG。给页面加载带来明显的延迟。

ie7.js(和 ie9.js)

为您提供许多 CSS3 选择器、最小和最大宽度、多个类和固定定位。如果您愿意,也可以修复 png。似乎并没有让事情放慢太多。

结论

我的建议分为两类:

如果您只是使用新的(互联网上有 2 年的新内容?!)元素和 CSS3 选择器,那么请使用 ie9.js + html5shiv。这是轻量级的,可以让您继续工作,而不必记住 IE6 不支持任何内容。

如果你使用了很多 CSS3 的东西,那么 CSS3PIE 会整理出 border-radius 和 box-shadow。渐变支持看起来有点不稳定,所以我总是使用后备图像。 Modernizr 可让您轻松地将不同的属性传递给具有不同支持的浏览器。我主要用它来确定浏览器是否具有 CSS 过渡和变换,因为它们对于任何图像滑块或内容轮播都很有用。值得使用定制工具来仅包含您想要的功能 - Webforms 内容会显示一个包含 50 的文本框几毫秒,因此如果您不想要它,则值得将其禁用。

希望这有帮助!

I've got extensive experience with all of these, having used them for a few years each.

Modernizr

Includes HTML5shiv functionality
Also does a lot more – if you don't use the other features, then don't use it, it does slow down page loads, but is worth it if you need it!

HTML5shiv

Very small, just fixes html5 elements in IE, nothing else.

CSS3PIE

Lets you use border-radius, gradients and box shadow in older versions of IE. Also can allow PNGs in IE 6. Adds a noticeable delay to page load.

ie7.js (and ie9.js)

Gives you many CSS3 selectors, min and max width, multiple classes and fixed positioning. Also can have a png fix if you like. Doesn't seem to slow things down much.

Conclusion

My advice would fall into two categories:

If you are just using the new (is 2 years new on the internet?!) elements, and CSS3 selectors, then use ie9.js + the html5shiv. This is lightweight, and just lets you get on with things without having to remember that IE6 doesn't support anything.

If you are using a lot of CSS3 stuff, then CSS3PIE will sort out border-radius and box-shadow. The gradient support seems a little flaky, so I've always used a fallback image instead. Modernizr lets you easily deliver different properties to browsers with different support. I've mainly used this for determining whether a browser has CSS transitions and transforms, as they are useful for any image sliders or content carousels. It's worth using the customisation tool to only include the functionality that you want – the webforms stuff shows a textbox with 50 in it for a couple of milliseconds, so it's worth disabling if you don't want it.

Hope that's helpful!

风流物 2024-11-08 08:22:03

我建议您只使用您需要的东西。在支持您正在使用的功能的浏览器中构建您的应用程序,并定期在您支持的其他浏览器中进行测试。如果某些内容无法正常工作,请找到适当的修复程序,无论是 html5shiv、IE9.js、Modernizr 还是 CSS3 Pie。您不会在一个页面中使用 HTML5 和 CSS3 中的所有新功能,因此您不需要包含现有的每个 polyfill 库。等到您发现您尝试使用的功能存在问题时,然后尝试找到执行此操作所需的库。

I would recommend you use only what you need. Build your app in a browser that supports the features you are using, and periodically test in other browsers that you support. If something isn't working correctly, find the appropriate fix, whether it be html5shiv, IE9.js, Modernizr, or CSS3 Pie. You are not going to use all of the new features in HTML5 and CSS3 all in one page, so you don't need to include every polyfill library in existence. Wait until you find problems with the features you're trying to use, then try and find the library necessary to do that.

睡美人的小仙女 2024-11-08 08:22:03

我主要使用 CSS3Pie...它效果很好。但是今天下午我在我的笔记本电脑上用 I.E8 测试了它,并且有一个问题...它禁用了一些 css 行...当我删除 css3pie 代码时我的网站获得了两倍的速度...然后我来了在帖子中,人们争论 css3 速度变慢...所以目前我正忙着为 IE7 和 IE7 寻找另一种方法。 IE8 具有边框半径和阴影。

如果您想使用它...请进行大量测试,因为它是非官方修复

I've used mainly CSS3Pie...it works great. But this afternoon i tested it on my laptop with I.E8 and there was an problem with it...it was disabling some css lines...when i removed the css3pie code my site gained twice the speed...then i came accross the posts with people arguing about the css3 slowdown...So at the moment i'm busy to find another way for IE7 & IE8 to have border-radius and shades.

If you want to use it...please test alot as it is NON-official fixes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文