哪个更好,CSS透明度或PNG透明度? [英] Which is superior, CSS transparency or PNG Transparency?

查看:142
本文介绍了哪个更好,CSS透明度或PNG透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用PNG透明度还是CSS透明度?

Should I use PNG transparency or CSS transparency?

我的第一本能就是使用CSS。但是我听说在IE的过滤器是缓慢的,我会得到更好的结果与PNG(忽略IE6)。

My first instinct is to go with CSS. However I heard somewhere that the filter in IE is slow and that I would get better results with PNG (ignoring IE6).

但从个人经验,我知道PNG透明度

However from personal experience I know that PNG transparency is slow in FF3.

有没有明确的答案?

$ b

推荐答案

它们是两个不同问题的两个不同的解决方案。 CSS透明度(我假设你指的是opacity属性)将使整个元素(其边框,背景和内容)是透明的,而alpha PNG透明度仅在您使用图像的情况下有用,例如元素背景。

They're two different solutions to two different problems. CSS transparency (I assume you're referring to the opacity property) will make an entire element (its border, background and content) transparent, whereas alpha PNG transparency is only useful in situations where you'd use images, for example an elements background.

我不能想到很多情况下,你可以使用相同的效果。

I cant think of many situations where you could use either to the same effect.

课程 CSS3中的RGBA颜色,但是浏览器支持目前太低,因此不可行选项在公开面对的网站/应用程序。

There are of course RGBA colours in CSS3, however browser support is currently too low for it to be a viable option in public facing sites/applications.

PS我不能说我自己遇到了任何FF3 alpha PNG效果问题。

P.S. I can't say I've run into any FF3 alpha PNG performance issues myself.

后续以评论:

确定。在这种情况下,我将使用CSS opacity属性。

OK. In that case I'd go for the CSS opacity property.

虽然过滤器的性能可能不是最佳的IE6,这意味着你不必浪费带宽和图像上的其他HTTP请求。此外,如果你想要得到的图像工作在IE6以及你必须使用AlphaImageLoader,我相信会是慢的(如果不慢)比alpha滤镜。

Although the filters performance may not be optimal in IE6, it means you don't have to waste bandwidth and an additional HTTP request on an image. Plus, if you wanted to get the image to work in IE6 as well you'd have to use AlphaImageLoader, which I'm sure would be just as slow (if not slower) than the alpha filter.

这篇关于哪个更好,CSS透明度或PNG透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆