StylizedWeb

Subscribe to our updates:

A Design, WordPress and Tutorials Blog.

Dedicated to helping you learn the art and science of the web.

PNG transparency issues

If you are CSS coder, you've probably ran in to png transparency problems many times. Even Microsoft is having problems with it http://runonce.msn.com/runonce2.aspx open in IE6. So I'll tell you few problems and solutions I've handled so far.

First one is if you need just simple transparent image, without some special needs for example backgrounds etc. The solution would be png fix. I've used it many times but it has lots of faults, for example with padding, margins and absolute positioning. Sometimes i can mess up the rest of your JavaScript files, but anyway very useful script. You can download it here http://homepage.ntlworld.com/bobosola/pngfix.js and just include it in your <head> tag

PNG

  1. <!--[if lt IE 7.]>
  2. <script defer type="text/javascript" src="pngfix.js"></script>
  3. <![endif]-->

The second one can partly handle issues from first and it's pure CSS solution. I mostly use this for backgrounds, because if your path for a background is from CSS file then png fix can't handle it.

PNG

  1. .someelement {
  2. background-image: url(images/image.png);
  3. }
  4.  
  5. * html .someelemen {
  6. background-color: #333;
  7. back\ground-color: transparent;
  8. background-image: url(images/blank.gif);
  9. filter: progid:DXImageTransform.Microsoft.
  10. AlphaImageLoader(src="images/image.png", sizingMethod="scale");
  11. }
  12.  

I found this very useful, and also when you add some hover effects for example some color or other image. You can see live example here
NOTE: This simple hover is just example and it doesn't work in IE6

  1. .someelement:hover {
  2. background: #333;
  3. }
  4.  
  5. .someelement:hover {
  6. background-image: url(images/image2.gif);
  7.  
  8. }
  9.  

Only problem I had with this was with <a> tag, link just don't work (when it's in div with this kind of background) and i don't know why (talking again for IE6). And only solution i could think of was to place another absolute div over it for the links, content etc... Yes i know it's not elegant but it works if content is not dynamic.

Luckily more and more people are starting to use IE7, and i must say i have recently switched too, i had to have IE6 because of testing my code and when i found out for Multiple IE program I switched immediately ;)

Leave a comment on Stylized Web Have some feedback? Leave a comment

270 Comments So Far

  1. Plus, beeswax offers a very strong layer of protection. The nails, your hair, the sneakers,
    she’s surfaced with these things and has
    now been paing awareness oof them since she was young.
    Buut aside from thee names, and many other recognizable brands,
    guys were stuck in no-man’s land concerning cologne.

  2. Diner cruises are and a popular activity of tourists and locals alike, and the can create a fantastic highlight with a Bali
    getaway. Have a listing of places you’d love to visit inside the region. “The Spa” includes traditional treatments as well as a variety of custom offerings which were thoughtfully researched and meant to incorporate the very best healing practices in tthe Asian traditions.

  3. Demasiado bueno, muchas gracias por compartir.

  4. My spouse and I absolutely love your blog
    and find nearly all of your post’s to be just what I’m looking ideas for young entrepreneurs.
    Do you offer guest writers to write content foor you? I wouldn’t mind writing a
    post or elaborating on mamy of the subjects you
    write about here. Again, awesome blog!

  5. Family campfire cookinbg is unquestionably fun however you
    should consideer the necessary steps in ordder that everybody is eating safely.

    Online classified – Many local newspapers and magazines offer online for free event listing.
    If you rooll boneless roasts, gett them to as cylindrical when you can.

  6. While surgery would take off the unwanted chest fat
    to revive a flat chest, it iss aan expensive and quite often painful procedure that many either do nott want or are far too scared to
    undergo. Wheen around 1 month to help you sixzty days, fellas are likely to go through different things with the width and length on their ownn
    dick. Ginseng is amongst the beneficial components within the product – it adds
    to the blood vessels inside the groin location helping to make your enis largesr plus
    more lengthy and stays using this method indefinitely.

  7. Nice post. I learn something new and challenging on sites I
    stumbleupon on a daily basis. It’s always exciting to read through articles from other authors
    and use something from other sites.

  8. Thanks for sharing your thoughts on wireless routers.

    Regards

  9. Hello there, just became alert to your blog through Google, and found that it’s truly informative.
    I’m going to watch out for brussels. I will be grateful if you continue this in future.
    Many people will be benefited from your writing. Cheers!

  10. Useful info. Lucky me I discovered your web site unintentionally, and I’m shocked
    why this accident didn’t took place in advance!

    I bookmarked it.

  11. Check into ratings and determine what ages are
    appropriate for games with an “M” rating. Once the player completes the introductory quests with his trusty or rusty Velator,
    the player will be escorted to Gallente controlled space.
    And believe it or not, LOTS of those people end up
    purchasing LOTS of gems.

  12. Remarkable! Its actually amazing post, I have
    got much clear idea about from this paragraph.

  13. Hey, I think your site might be having browser compatibility issues.
    When I look at your blog in Chrome, it looks fine but when opening in Internet Explorer, it
    has some overlapping. I just wanted to give you a quick heads up!

    Other then that, fantastic blog!

  14. I do not know if it’s just me or if perhaps everyone else encountering
    problems with your blog. It appears like some of the text within your posts
    are running off the screen. Can someone else please comment and let me know if this is
    happening to them too? This may be a issue with my internet browser because I’ve had this happen before.
    Kudos

  15. May I just say what a comfort to discover a person that genuinely understands what they’re talking about on the web.
    You definitely know how to bring an issue to light and make
    it important. More people must read this and understand this side of your story.

    I was surprised you’re not more popular since you certainly have the gift.

  16. I think the admin of this web site is truly working hard in support of
    his web site, because here every material is quality based material.

  17. Why viewers still use to read news papers when in this technological globe the whole thing is
    presented on web?

  18. Hurrah! At last I got a web site from where I be able to really obtain valuable data regarding my study and knowledge.

  19. Hey there terrific blog! Does running a blog like this take
    a great deal of work? I’ve no understanding of programming however
    I had been hoping to start my own blog in the near
    future. Anyway, should you have any ideas or techniques for new blog owners please share.
    I understand this is off subject nevertheless I simply wanted
    to ask. Many thanks!

  20. Thanks for sharing your thoughts about best headset.
    Regards

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>