R
R
Ramil2015-04-28 13:58:37
css
Ramil, 2015-04-28 13:58:37

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

2 answer(s)
R
Roman, 2015-04-28
@paradoxo

selector{
.... 
bacground: url(sprite.png) x1 y1 no-repeat;
}
selector:hover{
  background-position: x2 y2;
}

B
bob_cody, 2015-05-15
@bob_cody

https://www.youtube.com/watch?v=e-EkBx-CNqo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question