Page 1 of 1

image link borders

Posted: Mon Jan 08, 2007 11:09 am
by jyhm
I tried a search in this forum under image borders but I only found 23 results, and not quite what I was looking for.

This is annoying but every time I make an image that is a link i.e.:

Code: Select all

<a href="example.com"><img src="example.com/img/example.jpg" /></a>
I get a border around the image and I can only get rid of it by putting a style within the image tag itself. I have tried a using a separate class for the href and the img tag. However it only works with in the img tag itself i.e. :

Code: Select all

<ims src="example.com/img/example.jpg" border="0" />
Which I believe is not compliant.

Thank you for any help.

Posted: Mon Jan 08, 2007 11:22 am
by Kieran Huggins

Code: Select all

a img {border: 0;}

Posted: Mon Jan 08, 2007 11:35 am
by jyhm
Ok thanks KH,..

I was doing stuff like this:

Code: Select all

		 	
a.img:link {
   border: none;
 }
		 
		 
a.img:visited {
   border: none;
 }
		 
a.img:hover {
   border: none;
 }
		 
a.img:active {
   border: none;
 } 
But I guess that is the incorrect syntax.

Posted: Mon Jan 08, 2007 12:06 pm
by Kieran Huggins

Code: Select all

a img {border: 0;}
matches an image that is a descendant of an anchor. It's the image you need to style ;-)

Cheers!