tags:

views:

2854

answers:

5

When I turn an image () into a hyperlink (by wrapping it in ), Firefox adds a black border around the image. Safari does not display the same border. What CSS directive would be best to eliminate the border?

+2  A: 
    a img {
 border-width: 0px;
}
George Mauer
That's invalid CSS: '0' does not have a unit. Should just be "border-width: 0;".
Bobby Jack
what rule says 0 can't have a unit?
John
0 might not have a unit, but px does have a length...
ck
+11  A: 
img{
    border: 0
}

or old-fashioned

<img border="0" src="..." />
     ^^^^^^^^^^
pilif
This solution helped me out a lot, wish I'd found it before the 2 hours of frustration! But I think using "a img{border: 0;}" is a better fitted solution to the original problem - the emphasis on the initial "a" because the problem only occurs when an image is wrapped in a hyperlink
Matt Haughton
+1  A: 

Just add:

border: 0;

or

a img{
border:0;
}

to remove border from all image links.

That should do the trick.

Kamil Zadora
+3  A: 

in the code use border=0. so for example:

<img href="mypic.gif" border="0" />

within css

border : 0;

under whatever class your image is.

enigmatic
attention: Your <img> tag is not correct. Either you have to use " to quote the border attribute value (because XML requires that), or you have to remove the / before the ending > (because SGML/HTML doesn't allow that)
pilif
A: 

@george-mauer: Can you edit your answer and remove the "px", as per my comment, to ensure it's valid? I would down-vote it, but I don't have the rep (quite) ;-)

Bobby Jack