If you're looking for a simple solution, check out this method: Fiddle. You can also utilize a sprite sheet available at: https://i.sstatic.net/OWeVC.png
There are a couple of ways to achieve this effect. One approach is to use CSS, as shown below:
#mylink-1 {
background: transparent url('/img/my-img.png') 0 0 no-repeat;
}
#mylink-1:hover {
background: transparent url('/img/my-img-over.png') 0 0 no-repeat;
}
#mylink-2 {
background: transparent url('/img/my-img-2.png') 0 0 no-repeat;
}
#mylink-2:hover {
background: transparent url('/img/my-img-2-over.png') 0 0 no-repeat;
}
Alternatively, you can utilize a sprite sheet like this:
#mylink-1 {
background: transparent url('/img/my-img.png') 0 0 no-repeat;
}
#mylink-1:hover {
background: transparent url('/img/my-img-over.png') 0 -20px no-repeat;
}
The other approach involves using JavaScript, especially if you're working with jQuery:
$('#mylink-1').on('hover', function() {
$(this).css({ background: 'transparent url("/img/my-img-over.png") 0 0 no-repeat' });
});
If you have multiple links to modify and want to streamline the process using numbered images or sprites, consider this method:
var i = 1;
// For non-sprite images
#('.mylinks').each(function() {
$(this).css({ background: "transparent url('/img/my-img-' + i +'-over.png') 0 0 no-repeat" });
i++;
});
var i = 0;
// For sprite images
#('.mylinks').each(function() {
$(this).css({ background: "transparent url('/img/my-img-over.png') 0 ' + i + 'px no-repeat" });
i -= 20;
});