WordPress.org

Ready to get started?Download WordPress

Forums

help with image switch by browser (3 posts)

  1. ergate
    Member
    Posted 7 years ago #

    I am trying to do something that would seem rather simple but I am running into big solutions.

    I have a single graphic/image that is on a page, it is a png making use of the trasparency. I would like the image to switch to a gif whenever IE loads the page. So far I keep finding big scripts and fairly intensive solutions. Any body have something simple and light.

  2. StyledSheet
    Member
    Posted 7 years ago #

    yeah, in the stylesheet use the png as the default backgroung image for wherever you want it.

    Then, make use of the IE6 hack, and tell it to make the defauly image as the gif.

    i.e.

    #header{
       background:url(images/image.png) 0 0 no-repeat;
       }
    
    *html #header{
       background:url(images/image.gif) 0 0 no-repeat;
       }

    Now, in any browser except for IE6, the background will be the png, and in IE6 the background will be the gif.

    good luck?

  3. ergate
    Member
    Posted 7 years ago #

    Fantastic, thanks. I will add these to my reference material.

    I did find another solution that allows me to use the png. It was very easy to use, add one line to the css and add the script to the site. (fixes the alpha chanel with transparent gif)

    Well, now you can add decent PNG support to IE5.5+ on Windows with no changes to your website HTML source code. This script will add near-native PNG support with full alpha opacity, with only one line in your CSS file, that applies to all <img> tags and also background images!

    found here http://www.twinhelix.com/css/iepngfix/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.