Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop broken images showing

Tags:

html

jquery

css

I have a table with some images that I want to start out with no images in them.I have set the src="".But when viewed in a browser it shows broken image pics.

<tr>
<td><img src=""> </td>
<td><img src=""> </td>
<td><img src=""></td>
</tr>

How can I prevent the browser from showing the broken image pics or X or whatever until I put some data into the src attribute.

like image 700
james Avatar asked Jul 08 '11 09:07

james


2 Answers

Don't use images that point to nothing.

You could style them to have no visibility (will not work if you have anything in the src attribute, even if it is a bad URL):

img[src=''] 
{
  display: none;
}

But as I already said, if you don't have an image do display, don't put the tag on the page.

like image 136
Oded Avatar answered Oct 27 '22 21:10

Oded


Very simple answer is add alt attribute with empty value

<img src="" alt="" width="50" height="50"/>

width & height are optional

like image 36
Ganesh Kumar Avatar answered Oct 27 '22 23:10

Ganesh Kumar