I'm using a transparent 1x1 image with a background image, to be able to use sprites and still provide alternative text for some icons.
I want to use a data URI for the image to reduce the number of HTTP requests, but what would be the smallest possible string to produce a transparent image?
I realize I could use data URI:s for the actual images instead of sprites, but it's easier to maintain when everything is kept in the CSS instead of scattered around.
After playing around with different transparent GIFs, some are unstable and cause CSS glitches. For example, if you have an
<img> and you use the tiniest transparent GIF possible, it works fine, however, if you then want your transparent GIF to have a
background-image, then this is impossible. For some reason, some GIFs such as the following prevent CSS backgrounds (in some browsers).
Shorter (but unstable)
I would advise using the slightly longer and more stable version as follows:
As another tip, don't ommit
image/gif as one comment suggests. This will break in several browsers.