image link borders

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
jyhm
Forum Contributor
Posts: 228
Joined: Tue Dec 19, 2006 10:08 pm
Location: Connecticut, USA
Contact:

image link borders

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Code: Select all

a img {border: 0;}
User avatar
jyhm
Forum Contributor
Posts: 228
Joined: Tue Dec 19, 2006 10:08 pm
Location: Connecticut, USA
Contact:

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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!
Post Reply