Reputation: 9797
If you give an src and it cannot find the img it usually appears a square with a X. Is there any way to avoid that? I mean if it cannot find the img, just show nothing
You can check your solution here:http://jsfiddle.net/GmBax/
HTML:
<img src="1.png" width="42" height="42" >
Upvotes: 0
Views: 252
Reputation: 4517
There's another option, you can load a default empty image on error. Ex: <img src="/img.jpg" onerror="this.src='/none.jpg'" />
Upvotes: 1
Reputation: 13866
Use the alt parameter for example.. You can either add a text or leave it empty.
<img src="1.png" width="42" height="42" alt="" />
Or handle it by some PHP or whatever you're using.
Upvotes: 0
Reputation: 28573
put in an "alt" and a "title" tag - this way if the image doesn't show, the alt text will show instead.
e.g.
<img src="1.png" width="42" height="42" alt="hello" title="hi">
Upvotes: 0