This is a weird issue that happens when you don't specify an img src
. The browser wants to show that the element exists but doesn't have any content so it wraps it with a border. You can fix this by declaring the img
's source in the HTML.
Try this fiddle: http://jsfiddle.net/A2zAv/3/
If you don't want to declare an img src, don't use the img element for your image. You could use a div and get around this rendering issue instead. This will allow you to contain
the image to the container as needed.
As a further alternate, you could insert a 1px by 1px transparent spacer gif in your image's src if you absolutely want to use an img
tag.
See Strange border on IMG tag for more details.