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:

Blogger J 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

9:31 PM  
Blogger 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.

7:38 PM  
Blogger Wes Melton said...

This comment has been removed by the author.

8:31 PM  
Blogger 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.

8:33 PM  
Blogger Wes said...

oops, forgot the ';' - its,

img {
border: 0;
}

8:34 PM  
Blogger matt said...

Tip Top, thanks!!

3:46 AM  
Blogger Jaycee said...

I got an alternative fix on this matter,

On the CSS just add

img {
border: transparent;
}

11:14 AM  
Blogger Jaycee said...

I got an alternative fix on this matter,

On the CSS just add

img {
border: transparent;
}

11:14 AM  
Blogger Jeeba said...

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

10:01 PM  
Blogger 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

8:41 AM  

Post a Comment

<< Home