I’m trying to set up a sprite menu but it’s always showing first slide of srpite, in all links. This is my CSS:
#menu-social{float: right; width: 175px; margin-top: 5px; list-style-type: none;}
#menu-social li{display: inline-block; margin-right: 8px;}
#menu-social li a{display: block; height: 18px; background: url(images/spr_sociales.png) transparent no-repeat;}
#link-google-plus{width: 30px; background-position: 0 0;}
#link-twitter{width: 21px; background-position-x: -30px; /*or background-position: 0 -30px;*/}
#link-facebook{width: 21px; background-position: 0 -51px;}
#link-tuenti{width: 21px; background-position: 0 -72px;}
But it always shows Google+ icon, which is the first one in the sprite.
What am I missing?
Thank you
You’re having what I call a selector score issue.. Since your first rule
#menu-social li auses an ID + element + element, it overload the following rules#link-facebook, with only the ID.Give a try on this snippet:
A simple/elegant solution would be to change the IDs to classes (you don’t need that much IDs), like this:
More links on this issue here: