verlager
verlager

Reputation: 876

How to stop border under link images?

I have most of my html text links defined as:

a:hover {text-decoration:none; border-bottom:2px dotted #DB8D41}

But I also have images at http://communitychessclub.com/rabren/ which are links. I do not want the "border-bottom:2px dotted #DB8D41" to show under these images.

It is obvious that this below will not work:

a:hover img {border:none}
img, img:active { border: none }

Anybody have a solution?

Upvotes: 1

Views: 170

Answers (1)

user527892
user527892

Reputation:

This seems to work: http://jsfiddle.net/44Pwr/

html

<div><a href=#"><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif"></a><p>This is <a href="#">another link</a></p></div>

css

body { padding: 10px; background: #003; color: #999; }

a:link, a:visited { border-bottom: 1px solid #009; text-decoration: none; color: #CCC; }

a:hover, a:active { border-bottom: 1px solid #CCC; text-decoration: none; color: #CCC; }

a > img { display: block; border-bottom: 0; }

Upvotes: 1

Related Questions