我有这个导航条图标如下所示,在悬停时我想显示一个不同的图标,意味着相同的图标在蓝色引导图标不能使用,因为许可证问题。那么,在悬停以将图标更改为alerts_torqHover.png时,可以做些什么?
<div class="topbaricons">
<img src="assets/icons/alerts_torq.png">
<a><img src="assets/icons/alerts_torqHover.png"> </a>
</div>
发布于 2019-07-10 04:29:47
您可以通过CSS完成它,并且它将在所有浏览器上支持。
.topbaricons a {
display: none;
}
.topbaricons:hover>img {
display: none;
}
.topbaricons:hover a {
display: block;
}<div class="topbaricons">
<img src="https://placeimg.com/100/100/all">
<a><img src="https://placeimg.com/100/101/all"> </a>
</div>
发布于 2019-07-10 04:02:45
我推荐这样的东西。即使你需要它链接到其他地方,只要把img标签放在锚,因为他们将无法点击而不盘旋反正。
在img标签上的应用
img:hover {
content: url("http://placecage.com/c/480/240")
}<img src="http://placecage.com/c/240/120" />
On 类
.hover-change:hover {
content: url("http://placecage.com/c/480/240")
}<img class="hover-change" src="http://placecage.com/c/240/120" />
发布于 2019-07-10 03:20:29
在:hover类中尝试这样的方法
.topbaricons:hover .mango {
display: block;
}
.topbaricons:hover i,
.topbaricons:hover .orange {
display: none;
}
.mango,
.orange {
display: none;
}
i,
.orange {
display: block;
}
img {
width: 100px;
}<div class="topbaricons">
<img class="mango" src="http://www.twentyonepilots.com/sites/g/files/g2000004896/f/Sample%202_0.jpg">
<img class="orange" src="https://images-na.ssl-images-amazon.com/images/I/51TcdS9z2fL._SY300_QL70_.jpg">
<i class="userName" style=" margin-left: 15px">ICON</i>
</div>
https://stackoverflow.com/questions/56962912
复制相似问题