1

我将大部分 html 文本链接定义为:

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

但我在http://communitychessclub.com/rabren/也有图片,它们是链接。我不希望在这些图像下显示“border-bottom:2px dotted #DB8D41”。

很明显,下面这行不通:

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

有人有解决方案吗?

4

1 回答 1

1

这似乎工作: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; }
于 2012-11-05T11:27:12.013 回答