Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it okay these days to use PNG with alpha-transparency in websites?

I remember from 3 years ago that it was an absolutely huge pain to use any nice PNG with alpha in websites, because of IE6 and other bad browsers.

But how about now? How about if your target audience are iPhone, iPad and iPod Touch users? I believe these people aren't so stupid to use old-aged bad browsers. They use the newest, best stuff they can, and they're tech-savvy and intelligent. Is this an valid assumption? So does this mean I can safely use PNG with alpha to create great websites for my apps without having to worry about uglyness?

like image 337
openfrog Avatar asked Oct 07 '10 19:10

openfrog


People also ask

Is PNG suitable for websites?

If you are looking for a high quality, clear image, choose a PNG. What kind of file type should I use for my website logo? PNGs support transparency, and it is the best option for website logos that need to appear on various color backgrounds.

Does PNG support alpha transparency?

An alpha channel, representing transparency information on a per-pixel basis, can be included in grayscale and truecolor PNG images.

Should PNG be transparent?

PNGs are a better choice when you need a transparent image or want something with incredibly crisp, clear lines (like a line drawing or other iconic graphics). Another option is a GIF. GIF files can have transparent backgrounds, however, there are some benefits to using a PNG over a GIF.

Can PNG handle transparency?

The GIF and PNG formats also both support transparency. If you need any level of transparency in your image, you must use either a GIF or a PNG. GIF images (and also PNG) support 1-color transparency. This basically means that you can save your image with a transparent background.


3 Answers

Yes it's absolutely fine to use PNG's with Alpha Transparency. It actually always has been, you just had to fix IE6 with filters.

So go ahead and use them :)

like image 125
Marko Avatar answered Sep 22 '22 03:09

Marko


When I have to use alpha-transparent PNGs, I like to handle older browsers with DD_belantedPNG.

Then you can set up an IE conditional to call the PNG fix on the specific elements you need.

    <!--[if IE 6]>
        <script type="text/javascript" src="/lib/js/DD_belatedPNG-min.js"></script>
        <script type="text/javascript">
            DD_belatedPNG.fix('#Logo a img');
        </script>
    <![endif]--> 

You probably want to avoid blanket PNG fixes that apply to all PNGs on the page.

Remember, if you don't need the alpha-transparency 8-bit PNGs will work everywhere.

like image 36
Mark Biek Avatar answered Sep 23 '22 03:09

Mark Biek


There are several JS libraries that will add support for transparent PNGs in IE6. I use pngfix.js: http://jquery.andreaseberhard.de/pngFix/

There is also a standalone version of that plugin if you aren't using jQuery.

like image 24
ashicus Avatar answered Sep 23 '22 03:09

ashicus