I have created a sprite which includes a whole set of icons which I use in my web application. However, I have run into a problem when styling links. I know with CSS I can manipulate the size of the link and move its background image (the sprite) around, so I only display the icon I want within the sprite. This works great for links with no text. However, if I have a link with a background image and additional text, that is where I run into problems.
Take a look at these images, which will explain my dilemma:
- Icon sprite: https://picasaweb.google.com/lh/photo/vN74tYI2lsdjOCpvdLjdPBV2JJooBc4dMF1MOKsl3b4?feat=directlink
- Dilemma: https://picasaweb.google.com/lh/photo/UkC1dP7Fzxv02f_xjX-AEBV2JJooBc4dMF1MOKsl3b4?feat=directlink
I know I can “clip” the background image in CSS3, but I am trying to avoid that at this point, because I know mainly older browsers [like IE8 X(] will be accessing the site, and won’t see this change. Is there a way to do this without placing an additional tag, such as a <span> tag inside of each link and styling those? I’ve seen examples where I can use an AJAX library, like jQuery, to help with this, but that is alot of sweat for a small task.
I hope that wasn’t confusing.
You need to put blank space in your sprite where you need to. That should do the trick.
Just like this one > http://css-tricks.com/wp-content/csstricks-uploads/youtube-sprite.png