views:

72

answers:

4

I have used this effect before, everything is in order (As far as I see), but it's just not working. What have I missed?

Fiddle here

Sprite here

Thanks.

A: 

Um, your background-position is adjusting the top starting position rather than the left starting position?

Damien_The_Unbeliever
Hahahahahahahh @me!
Kyle Sevenoaks
+2  A: 

Since your sprite is arranged horizontally, you will want to offset the hover state like this:

element:hover {
background-position: -77px 0;
}
kingjeffrey
Note, the swapped order and the negative value. Both are needed.
kingjeffrey
I am so dumb today, thanks!
Kyle Sevenoaks
It is a mistake I make all the time. I just think back to high school geometry and all those (x,y) coordinates. background-position has the same order.
kingjeffrey
+1  A: 

Your background offset seems to be wrong - instead of 0 77px (which is a y-offset, along the wrong axis), try -77px 0.

MadKeithV
+1  A: 

just change

background-position: 0 77px;

to

background-position: -77px 0;
oezi