Images display in Firefox and Safari, but not in Internet Explorer
Heads up! This post was written in 2009, so it may contain information that is no longer accurate. I keep posts like this around for historical purposes and to prevent link rot, so please keep this in mind as you're reading.
— Cory
I ran into a little "gotcha" today where an image was displaying properly in Firefox and Safari, but not in Internet Explorer. The weird thing is that it wasn't showing up as a broken link (no missing image icon with the infamous red 'X'). Instead, it wasn't showing up at all:
<img src="image.jpg" width="" height="">
As it turns out, if you have the width
and height
attributes set to an empty string, IE seems to interpret the width and height as zero, which makes the image not appear. All other browsers, of course, seem to discard the empty attributes.
The solution? Simply remove the empty attributes or plug in the appropriate values.