Answer the question
In order to leave comments, you need to log in
How to hover an element using a sprite?
On the frontend, I generate sprites from icons that I throw into a special folder using gruntjs.
The grant also automatically generates a css file with the positions of a certain icon. And of course, every time I put a new icon in the sprite folder, the css file is regenerated and the positions of the icons change.
How can I assign a hover to an element so that the icon changes when hovering over? Right now I'm using js for this.
Answer the question
In order to leave comments, you need to log in
selector{
....
bacground: url(sprite.png) x1 y1 no-repeat;
}
selector:hover{
background-position: x2 y2;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question