...

View Full Version : Hyperlinking images



Denier-of-Soup
10-31-2006, 11:31 PM
I've been trying to figure out a way to link an image on my website to the main page, but the problem is that whenever I do this, a border pops up around the image because of "a:hover {text-decoration: none; color: #000000;}" from the style sheet.

Is there a way I can link it to the main page without making it use the a:hover property?

kaitco
10-31-2006, 11:41 PM
img a {
border-style: none;
}

Denier-of-Soup
11-01-2006, 12:34 AM
I've added that to the style sheet, but how am I supposed to use it?


<img src="http://codingforums.com/image.png" a href="http://codingforums.com/" alt="CodingForums.com" />

Arbitrator
11-01-2006, 12:49 AM
It should be a img not img a. An a img selector will select all anchor elements that contain an image element (all image links) and apply the associated styles. A valid XHTML construct that would be selected:


<a href="/">
<img alt="Alternative Text" src="image.png"/>
</a>

Denier-of-Soup
11-01-2006, 01:20 AM
That worked. Thanks, guys.

Denier-of-Soup
11-01-2006, 01:34 AM
Sorry for the double post, but the borderless image doesn't seem to be working properly. I don't see any borders in Safari, but I can still see them if I use Firefox.


HTML

<a href="/"><img alt="Alternative text" src="image.png"/></a>


CSS

a {text-decoration: none; color: #7C7C7C;}
a:hover {text-decoration: none; color: #000000;}
img a {border-style: none;}

http://denier.foohost.be/index/freelancer/

_Aerospace_Eng_
11-01-2006, 02:39 AM
I don't think you read Arbitrator's post too carefully. It should be

a img {
border:0;
}
NOT

img a {
...
}

kaitco
11-01-2006, 04:11 AM
My bad. Sorry!:o

Denier-of-Soup
11-01-2006, 09:10 PM
That worked. Thanks again. =P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum