且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

哪个更好,CSS透明度或PNG透明度?

更新时间:2023-01-18 11:26:29

它们是两个不同问题的两个不同的解决方案。 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.