David19801 David19801 - 1 year ago 106
HTML Question

HTML if image is not found

I have an image in a HTML page:

If the image is not found on the server it shows an ugly blank square.

I want to make it so that if an image is not found it will display nothing or some other default image that I know is definitely on the server.

How can this be done?

Answer Source

Solution - I removed the height and width elements of the img and then the alt text worked.

<img src="smiley.gif" alt="Smiley face" width="32" height="32" />


<img src="smiley.gif" alt="Smiley face" />

Thank you all.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download