我有一个适合打印的/PDF 图像,如下所示:
好的,很简单。但是,当将鼠标悬停在它上面时,背景会变成灰色,因为我将默认超链接设置为此,例如:
#footer a:hover {
color: white;
background-color: #636363;
-moz-transition: all .6s linear;
-webkit-transition: all .6s linear;
-o-transition: all .6s linear;
transition: all .6s linear;
text-decoration: none;
outline: none;
}
所以问题就变成了,我可以在这个 WordPress 域上使用什么 css 规则来阻止背景颜色的发生?将鼠标悬停在图片上时,我希望没有背景色。这是我尝试过的:
.printfriendly a:hover img {
background-color: transparent !important;
opacity: 1.0 !important;
}
除其他外,但这行不通。这是我在 Firebug 中看到的:
当我右键单击并将 html 复制到该选择时,这是 html 输出:
<div class="printfriendly pf-alignright"><a onclick="window.print();if(typeof(_gaq) !=
'undefined') { _gaq.push(['_trackEvent','PRINTFRIENDLY', 'print', 'NULL']);} return false;"
rel="nofollow" href="http://www.printfriendly.com/print?url=http://www.occupyhln.org/occupy-
hln-hall-of-heroes/"><img alt="Print Friendly" src="http://cdn.printfriendly.com/pf-button-
both.gif" style="border:none;-webkit-box-shadow:none; box-shadow:none;"></a></div>
所以我几乎不知所措 -- 随着我学习更多、试验和阅读,这种情况在 CSS 中发生的情况越来越少,但是任何人都可以提供任何关于如何摆脱这种背景的帮助- 将鼠标悬停在打印/pdf 图像上时的颜色将不胜感激!如果需要,这里有一个例子:http://www.occupyhln.org/occupy-hln-hall-of-heroes/
最佳答案
背景颜色不在图片上,而是链接本身。
.entry-content a:hover { background: none; }
关于css - 如何覆盖 :hover hyperlinked images? 上的默认 css 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18328215/