useful CSS hack - replace an image with an.. er.. image

via hicksdesign:-

img {
width: 0;
padding-left: 20px;
background: url(mynewimage.gif) no-repeat;
}

I have a real-world example of where this would be useful in plone skinning - in some places inline images are still used for icons (here and there - they are generally being phased out). At the moment I usually set them to display:none and apply padding and background image to the containing element, but this may be a better solution.

One Response to “useful CSS hack - replace an image with an.. er.. image”

  1. Sarah Lewis Says:

    Just wanted to say thanks for this. :) It is exactly what I need for over-riding some annoying hard-coded images in a blog I’m skinning.

Leave a Reply