为什么IE会改变颜色?

发布于 2024-12-08 05:47:45 字数 227 浏览 0 评论 0原文

我已将图像放置在 div 之上。我正在尝试将图像混合到 div 中(div 是纯色)。在 Google Chrome 中,它看起来很棒!颜色完美融合。然而,在 IE 7 中,即使它们应该是相同的颜色,颜色也会显示出硬线!经过一些检查(将打印屏幕放入paint.net以检查实际的RGB值),IE 7实际上使我的图像更加明亮。

混合必须看起来无缝。到目前为止,谷歌浏览器对此表现良好。知道为什么 IE 7 无法正确显示颜色吗?

I've placed an image on top of a div. I'm trying to blend the image into the div (The div is a solid color). In Google Chrome, it looks great! The colors blend perfectly. In IE 7, however, the colors show a hard line even though they should be the same color! After some examination (a print screen put into paint.net to check the actual RGB values), IE 7 is actually lightning up my image.

The blend has to look seamless. Google Chrome was fine with this thus far. Any ideas why IE 7 wont display the color right?

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

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

发布评论

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

评论(1

吃→可爱长大的 2024-12-15 05:47:45

这两个浏览器使用不同的渲染引擎。它们之间在渲染图形(尤其是 jpeg)的方式上存在细微差别。

差异很小但不可避免。

大多数时候,它不会被注意到;只有在像您这样的情况下,当您尝试将其放置在具有相同背景颜色的元素上时,它才会出现。

您也许可以通过使用不同的图像格式来解决该问题。尝试将图像另存为 PNG。 PNG 在浏览器之间的渲染往往比 jpeg 更准确,因此这可能足以解决您的问题。

如果这不能解决您的问题,您可以尝试使用 PNG 的 alpha 透明度功能来生成边缘淡入透明的图像,然后重叠其后面的背景颜色。这肯定会给你一个平稳的过渡,但技术性更强,所以更难实现。它也会给你带来旧版本 IE 的问题(当然是 IE6,我想你用 IE7 也没什么问题),因为它们在 PNG 透明度方面有一些重大错误。 (如果这对您来说是个问题,有解决方法;谷歌 IEPNGFix 了解更多)

The two browsers are using different rendering engines. There are minor differences between them in how they render graphics, particularly jpegs.

The differences are minor but unavoidable.

Most of the time it goes unnoticed; it only makes an appearance in cases like yours when you try to position it against an element with a solid background colour that is supposed to be the same.

You may be able to resolve the issue by using a different image format. Try saving the image as a PNG. PNGs tend to be rendered more accurately between the browsers than jpegs, so that might be enough to solve your problem.

If that doesn't solve your problem, you could try using PNGs alpha transparency feature to produce an image with a fade to transparent at the edge, and then overlap the background colour behind it. This will definitely give you a smooth transition, but is a bit more technical, so harder to achieve. It will also give you problems with older versions of IE (IE6 for sure, I think you'll be okay with IE7), as they had some major bugs with PNG transparency. (If this is an issue for you, there are work-arounds for this; google IEPNGFix for more)

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