为什么 colorzilla 渐变在 IE 中不起作用?
我一直在使用 colorzila 工具来生成一些 css 渐变。除了 IE9 之外,它们可以在我测试的所有浏览器中运行;还没试过其他IE。 他们的 UI 上有一个 IE 复选框。当我将其设置为on时,渐变样本不再有渐变;它默认为基础纯色。
我认为它应该在 IE 中工作,因为它们确实包含以下 css 函数
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#221f1f', endColorstr='#221f1f',GradientType=1 ); /* IE6-9 */
I've been using the colorzila tool to generate some css gradients. They work in all browsers I test in save for IE9; haven't tried the other IE's yet.
They have an IE checkbox on their UI. When I set it to on, the gradient sample no longer has a gradient; it defaults to the base solid color.
I thought it should work in IE since they do include the following css function
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#221f1f', endColorstr='#221f1f',GradientType=1 ); /* IE6-9 */
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议放弃那些可怕的
filter
样式。有一个更简单、更兼容的解决方案可用。 CSS3Pie 是一个允许 IE 使用标准 CSS 渐变语法的库。它比
过滤器
更容易使用,并且也更容易在代码中维护。它适用于所有版本的 IE,而且它还对其他一些 CSS 功能(例如border-radius
)执行相同的操作。另外,我想指出,您的代码片段中的注释是不正确的 - 您的代码片段说“IE6-9”,但实际上
filter
样式已在 IE9 中停止使用,转而采用标准CSS 语法。不幸的是,这对您来说是一个问题,因为 IE9 也不支持标准 CSS 渐变。他们拿走了一些有用的东西(有点),并用……什么也没有取代它(在这种情况下)。
幸运的是,CSS3Pie 确实允许渐变,即使在 IE9 中也是如此,所以它可以解决您的问题。
希望有帮助。
I suggest dropping those horrible
filter
styles. There is a much easier and more compatible solution available. CSS3Pie is a library that allows IE to make use of the standard CSS gradient syntax.It's much easier to use than the
filter
, and easier to maintain in your code as well. It works in all versions of IE, and plus it also does the same trick for a few other CSS features too such asborder-radius
.In addition, I would point out that the comment in your code snippet is incorrect -- your snippet says "IE6-9", but in fact the
filter
style has been discontinued in IE9, in favour of standard CSS syntax.Unfortunately, this is a problem for you as IE9 doesn't support standard CSS gradients either. They've taken away something that worked (kinda) and replaced it with... nothing (in this case).
Fortunately, CSS3Pie does allow gradients, even in IE9, so it is the solution to your problem.
Hope that helps.
它们在 css 下有一个名为
IE9 支持 (?)
的按钮,请确保您检查并按照显示的说明进行操作。
They have a button under the css called
IE9 Support (?)
Make sure you check that and follow the instructions that appear.