I have an ul menu that exists from images with different widths for each li. I use sprite for guidance and bg. The sprite contains all the possible images for the menu. When I'm in, I want the background image to display 160 pixels each, and somehow inherit the horizontal position of the background (I understand that inherit inherits from the parent and not from the element you are calling: hover over).
How to raise the background position up and keep the horizontal position the same. Sample code below. I tried a lot of things, including the inherit option in the example below, and I know there is a CSS3 option called background-position-y, but it is not a crossbrowser ...
#menubar ul li.item-101{ width:183px; background-position: 0 0; } #menubar ul li.item-102{ width:163px; background-position: -183px 0; } #menubar ul li.item-103{ width:204px; background-position: -346px 0; } #menubar ul li.item-104{ width:117px; background-position: -550px 0; } #menubar ul li.item-105{ width:173px; background-position: -667px 0; } #menubar ul li:hover{ background-position: inherit -160px; }
source share