Tuesday, September 25, 2007

Firefox img border problem

Of course, since Firefox is probably the most compliant browser, this is more an artifact than a problem. But I'd like to help people out with this, so I'll keyword it: problem, bug, issue ...

In Firefox an image (img) with (a href) link tags around it, often shows up with a visually unwanted blue border. The fix is simple. Set " border=0 " in the img tag:

< img src="file.jpg" border=0 > 

10 comments:

Jeanne Platt said...

tried this and it works BUT then hte site is no longer XHTML 1.0 STRICT compliant, and mine needs to be. any other way around it? Please help!! Thanks

MoonKat said...

Greg,

Thanks for the fix. Worked like a charm. j, I put the 0 border as a style in my style sheet, targeting only specific pictures. This removes the formatting from the markup, which is what I presume you meant was non-compliant.

Wes said...
This comment has been removed by the author.
Wes said...

Referring to an XHTML strict solution, here is the answer - just add this in to your .css file somewhere.

img {
border: 0
}

This is both IE, FF, and Safari compliant.

Wes said...

oops, forgot the ';' - its,

img {
border: 0;
}

Unknown said...

Tip Top, thanks!!

Unknown said...

I got an alternative fix on this matter,

On the CSS just add

img {
border: transparent;
}

Unknown said...

I got an alternative fix on this matter,

On the CSS just add

img {
border: transparent;
}

Jose Carlos Tamayo said...

Thanks for the tip. XHTML compliant?? Hope a client doesnt ask for that.. meanwhile, Non XHTML compliant rulez :)

Jerry said...

I wanted a border around my linkable image, but not the fat ugly blue firefox border, so i enclosed the image within a div with the desired border, then set border:0 for the image.

To be xhtml compliant, then set the background color in div to minimize the ugly img margin mandated by xhtml