简体   繁体   English

一个很好的JavaScript框架,它为IE6-8增加了CSS3支持并在IE9中缺少CSS3?

[英]A good javascript framework which adds CSS3 support to IE6-8 & missing CSS3 in IE9?

I am surprised that the release version of IE9 is missing support for some more basic CSS3 elements like text-shadow and border-image. 我很惊讶IE9的发布版本缺少对一些更基本的CSS3元素的支持,比如text-shadow和border-image。

What's the most comprehensive JavaScript framework for adding/emulating CSS3 elements to IE6-9 instead of using a bunch of smaller frameworks like ie-css3, CSS3PIE, Modernizr, html5shiv,... etc? 什么是最全面的JavaScript框架,用于向IE6-9添加/模拟CSS3元素,而不是使用一堆较小的框架,如ie-css3,CSS3PIE,Modernizr,html5shiv,...等?

I am sure there's no single framework that does it all but I am looking for the closest. 我相信没有一个框架可以做到这一切,但我正在寻找最接近的框架。

What? 什么? You're suprprised that IE doesn't follow standards? 你不知道IE不符合标准吗? When will people learn... 人们何时会学习......

Try Selectivizr . 尝试Selectivizr From the website: "selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8. Simply include the script in your pages and selectivizr will do the rest." 来自网站:“selectivizr是一个JavaScript实用程序,可以在Internet Explorer 6-8中模拟CSS3伪类和属性选择器。只需在页面中包含脚本,选择器将完成剩下的工作。” I don't know what's the support of IE9 but it should be much easier than IE6 so I guess it should work fine. 我不知道IE9的支持是什么,但它应该比IE6容易得多,所以我想它应该可以正常工作。

You will still need some of those "smaller frameworks" though, because they do what they do just fine, they are small enough, so there's no point in reinventing the wheel just for the sake of having one big framework instead of few smaller ones. 你仍然需要一些“较小的框架”,因为他们做得很好,他们足够小,所以没有必要重新发明轮子只是为了拥有一个大框架而不是几个较小的框架。 It's hard to make a one-size-fits-all framework so that's why you have some diversity, and I think it's a good thing. 制作一个适合所有人的框架很难,这就是为什么你有一些多样性,我认为这是一件好事。

But don't expect that you'll just include some library and all of the browsers will get flawless CSS3 support because that's not gonna happen any time soon. 但是不要指望你只是包含一些库,并且所有浏览器都将获得完美的CSS3支持,因为这不会很快发生。

If you want advanced effects that would work consistently across all of the browsers from IE6 then I would recommend using Raphaël . 如果你想要在IE6的所有浏览器中一致工作的高级效果,那么我建议使用Raphaël It uses VML on IE and SVG on other browsers. 它在IE上使用VML ,在其他浏览器上使用SVG The API is also simpler than CSS, but that is of course a matter of taste. API也比CSS简单,但这当然是品味问题。 But even if not the API, it's pretty hard to beat the argument that you can have rounded corners and other goodies that look the same on Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+ without using images. 但即使不是API,也很难打败你可以在Firefox 3.0 +,Safari 3.0 +,Chrome 5.0 +,Opera 9.5+和Internet Explorer 6.0+上使用圆角和其他好东西而不使用的论点。图片。

The items in your list each do different things. 列表中的项目各有不同的东西。 I don't think it would make sense for one single framework to implement all of these things. 我不认为一个框架实现所有这些东西是有意义的。

Just include the ones from your list that you actually need. 只需在列表中包含您实际需要的那些。

  • You should (obviously) only use html5shiv if you're using HTML5 elements on your page: 如果你在页面上使用HTML5元素,你应该(显然)只使用html5shiv:

     <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> 
  • Modernizr has the functionality of html5shiv plus a lot of feature detection: Modernizr具有html5shiv的功能以及许多功能检测:

    Modernizr does not add missing functionality to browsers; Modernizr不会向浏览器添加缺少的功能; instead, it detects native availability of features and offers you a way to maintain a fine level of control over your site regardless of a browser's capabilities. 相反,它会检测功能的本机可用性,并为您提供一种方法,无论浏览器的功能如何,都能保持对您网站的精细控制。

    Use html5shiv if you just want to style the HTML5 elements in IE. 如果您只想在IE中设置HTML5元素的样式,请使用html5shiv。 Use Modernizr if you want to do different things depending on if certain features are supported, for example: 如果您想要执行不同的操作,请使用Modernizr,具体取决于是否支持某些功能,例如:

     .my_elem { border: 1px inset #666; } .borderimage .my_elem { border: none; border-image: url(fancy-border.png) 5 5 5 5 round; -moz-border-image: url(fancy-border.png) 5 5 5 5 round; -webkit-border-image: url(fancy-border.png) 5 5 5 5 round; } 
  • The idea behind CSS3PIE and Modernizr is very different. CSS3PIE和Modernizr背后的想法非常不同。

    The way CSS3PIE is most commonly utilized is inside CSS: CSS3PIE最常用的方式是CSS内部:

     #myElement { ... behavior: url(PIE.htc); } 

    Modernizr allows you to use native fancy new functionality while being safe in the knowledge that you can provide whatever custom fallback you desire for browsers that do not support the specific functionality. Modernizr允许您使用原生的新功能,同时保证您可以为不支持特定功能的浏览器提供您想要的任何自定义回退。

    Whereas CSS3PIE tries to perfectly emulate a limited set of CSS3 properties to work in only the older versions of Internet Explorer, with no additional work other than including the behavior property on relevant elements. 而CSS3PIE试图完美地模拟一组有限的CSS3属性,只在旧版本的Internet Explorer中工作,除了在相关元素上包含behavior属性之外没有其他工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM