Sometimes I wonder why I even bother with IE6 and why do I even care. Then I remember that literally millions of people out there are just too ignorant, and don’t even realize that IE is not the only option. I’ve got to hand it to Microsoft they cornered the market at a great time, and now millions of people suffer everyday.
So here is a little trick I came up with. (then again, this has probably already been done, and most likely been done better) I don’t consider this to be something to be used to much because it’s kind of a pain in the ass, but a handy trick to have under your belt.
The basic concept is using a blank.gif over a background image you want to make a link. The only reason you would ever really need this is if you can’t guarantee cross browser png support or you want to keep image load time down. maybe there are others but what ever.
Basically you just take the blank.gif and stretch it over what ever it is you want to make a link. There are obvious limits to this technique, but its helpful.
Here are the basics of an image. You could use a .class for these things if you like, or and #id.
< img src="" alt="" width="" height="" style="margin:;" / >
If you’re into php and WordPress here is a simple flexible function with some basic parameters to keep your typing down. (Honestly though I really only use this in special cases. I don’t advise using this on a large scale.)
spacing has been added to make this print…
function rlh_gif_($width=”,$height=”,$margin=”,$alt=”,$class=” ) {
$gif = get_bloginfo(‘url’ );
$gif .= ‘/wp-includes/images/blank.gif’;
? >
< img src="< ?php echo $gif; ? >” alt=”< ?php echo $alt; ? >” width=”< ?php echo $width; ? >” height=”< ?php echo $height; ? >” style=”margin:< ?php echo $width; ? >;” class=”< ?php echo $class; ? >” / >
< ?php
}