+2  A: 

I think that you must use javascript. You can use something like this:

var imgs=document.getElementsByTagName("img");
for(i=0;i<imgs.length;i++)
imgs[i].onerror=function(){
imgs[i].parentNode.removeChild(imgs[i]);
}

with this function you will remove all images with errors.

mck89
Thanks, any CSS solution for this? We also may have some divs loaded by AJAX and we might not be able to attach this onerror to each image.
ToughPal
+2  A: 

Based on your comment, why can't you just check if the image exists in your server-side script before outputting the HTML? There shouldn't be much of an overhead.

In PHP it would be something like:

<?php
if (file_exists($imgUrl)) {
    echo '<img src="', $imgUrl, '" alt="" />';
}
?>
DisgruntledGoat