使用:hover更改图像的颜色 [英] using a:hover to change the color of an image
问题描述
在以下示例中,将鼠标悬停在每个链接上方会改变图片:
http://www.prism.gatech.edu/~dm257/sprite.html
诀窍是下面这行代码:
#home a:hover {
background:transparent url .png')0px -37px no-repeat;
}
a:hover选择器将背景设置为sprite的绿色部分。 png。
我可以用a:visit?在用户点击它后,图标变成绿色?
我更改了a:hover到a:visited,没有任何反应。
https://developer.mozilla.org/En / CSS /%3A访问:
从Firefox 4开始,可以应用的样式的主要限制
这个选择器已经介绍。有关
限制及其动机的更多信息,请参见隐私权和:已访问
选择器。
其他浏览器也采用了相同的限制,包括
Safari 5 / 4.1和Chrome 6。
In the following example, a mouse hover over each link changes the image:
http://www.prism.gatech.edu/~dm257/sprite.html
The trick is the following line of code:
#home a:hover {
background: transparent url('sprite.png') 0px -37px no-repeat;
}
The a:hover selector sets the background to a green part of of sprite.png.
Can I do the same thing with a:visited? Make the icon turn green after the user has clicked it?
I changed a:hover to a:visited and nothing happens.
Styling of :visited
is currently limited to prevent security risk related to exposing user's browsing history:
https://developer.mozilla.org/En/CSS/%3Avisited:
Starting in Firefox 4, major limitations to the styles you can apply using this selector have been introduced. For more information on the limitations and the motivation for them, see Privacy and the :visited selector. The same limitations have been adopted by other browsers, including Safari 5/4.1 and Chrome 6.
这篇关于使用:hover更改图像的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!