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

211 Comments So Far

  1. Besides spray tan, you can also get lotions, gels, and
    creams that are easy to apply. The first utilizes an airbrush tanning booth the customer stands in while the solution is
    sprayed on the body. The instant will give
    you color as soon as you step out of the booth and the clear will develop over
    time (great for those of you who like to have a spray on your lunch
    break).

    Feel free to surf to my blog … chloe sims scunci ponytail holders with hair

  2. What’s up everyone, it’s my first pay a visit
    at this website, and paragraph is actually fruitful in support of me, keep up posting such content.

  3. I read a lot of interesting content here. Probably you spend a lot of time writing,
    i know how to save you a lot of work, there is an online tool that creates readable, SEO friendly posts in minutes, just
    search in google – laranitas free content source

  4. Hi superb blog! Does running a blog like this require a great deal of work?
    I’ve absolutely no expertise in coding however I had been hoping
    to start my own blog soon. Anyways, if you have any recommendations or tips for new
    blog owners please share. I know this is off topic nevertheless
    I simply wanted to ask. Kudos!

  5. I have learn ѕeveral jսst гight stuff ɦere. Ɗefinitely ѵalue bookmarking
    ffor revisiting. ӏ surprise Һow so mսch effort you plɑcе
    tο create ѕuch a fanyastic informative
    site.

    mу web ρage … fantage free membership codes

  6. Hi exceptional blog! Does running a blog similar to this require a great deal of work?

    I’ve absolutely no expertise in programming however I had been hoping to start my own blog soon. Anyway, should you have any ideas or tips for new blog
    owners please share. I understand this is off subject nevertheless I just
    needed to ask. Kudos!

    Here is my blog google

  7. I like the valuable information youu provide in your articles.
    I will bookark your blog and check again here frequently.
    I’m quite sure I will learn lots of new stuff right here!
    Best of luck for the next!

  8. magnificent put up, very informative. I ponder why the opposite specialists of this sector don’t notice this.
    You should proceed your writing. I’m sure, you’ve a huge
    readers’ base already!

    My web site; Ver el sitio web (Major)

  9. After looking over a number of the blog posts on your website, I
    truly like your way of writing a blog. I saved as a favorite it to my bookmark site list and will be checking back soon. Please check out my web site
    too and let me know how you feel.

    Feel free to visit my web-site :: Visitar este sitio
    aqui (Joni)

  10. The days of peeling your vegetables with a knife have been over since we
    have been blessed with the peeler. You may wonder what they can offer you that a regular oven doesn’t have,
    and that would be a greater precision in what you’re
    cooking, meaning no failed recipes or undercooked food. And so it
    was with Julia’s enamel sauce pan which she bought in Paris in the
    1940s and used up until the 1990s.

    Here is my web page: swerving

  11. You can really help most of your clients by helping them use financial statements as a basis for making better
    business decisions. They will do all the talking for you with the agent.

    Every year, thousands of vacancies open up in the public sector.

    Here is my web blog … Boca Raton CPAt testing

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>