The PNG problem finally resolved

Monday Apr 11 2005

There is no way of making PNG images that match CSS colors in all PNG-supporting browsers. This reduces the usefulness of the otherwise excellent image format. If the image colors and the colors defined in a style sheet need to match, it is safer to use GIF or JPEG.Henri Sivonen in The Sad Story of PNG gamma "correction"


Thanks to Nick on the Stylegala forum I finally got an answer to the most agonizing problem in web design I've encountered so far: my 's not behaving right in several . I've set up a little demo for you to 'enjoy' this problem.

Dark Matter Pro: a premium photoblog template.

Affiliate program available

I'm a container with #CDCDCD as background color defined in a style.
I'm a div with a PNG with the same color as a background! Not quite the same color eh?


The problem I experienced (including on this site until this morning) was the fact that colors in PNG's were rendered differently than CSS colors. For example if you place a PNG file with a plain color fill in #CDCDCD, it will render slightly differently than a page element that has it's color set to exactly the same #CDCDCD in your CSS. It almost drove me insane and various designers I've asked didn't have any explanation as for why this was happening. There's something really fishy going on with the so it seems.

There is currently NO WAY to fix this problem. Therefore the advise is to not use PNG's for any elements in your that are tightly related to elements that have matching colors assigned to them through . This website used to have this problem in the right margin where the purple column didn't quite match the background color of the elements in it. Changing the background image to a gif fixed this problem. A valuable lesson. Thanks again Nick!
bookmarking

Commentary

Join the discussion! Leave a comment through the comment form below!

Got something to add to this?

Feel free to leave a comment on this site. You can use Textile and Emoticons. Your email address is only used to show a gravatar. Please stay on-topic and use common decency. Spammers will be shot in front of a live studio audience.

If you plan on posting code, use pastebin please and post a URL to the code. The comment processing doesn't deal very well with code. Sorry for the inconvenience.

Human comment spammers: don't bother posting your crap here. Comments are moderated and I won't let any of your shit through.

Remember personal info?
Yes
No

Trackbacks

If you have an interesting related post on your own site you can leave a trackback. As they say: 'a little AJAX a day keeps the spammers away' which is why you'll have to click below to generate a trackback key. The key will be valid for 15 minutes and can be used only once.

Technology Blogs - Blog Top Sites

 

  • Featured Links
RockySomewhere near the Orion NebulaBookalicio.usGolden Gate BridgeThames River BankJackie and mePimpin' it