<a href="#" onMouseOver="document.getElementById('button1Inline').style.backgroundPosition='0px -90px';">
<img src="ads/button1.png" id="button1Inline" />
</a>
The button1.png is a 180 pixels tall sprite comprised of two effect halves. Due to unnatural forces beyond my control I have to make this work inline. I know it’s not best practice and I feel terrible about myself, but right now I just need it to work. Please and thanks!
One way to do that could be having a HTML like this:
And you could give it CSS properties like
display: block;ordisplay: inline-block;with the width of your image and half the height of it and then a:hoverstyle.For example:
That way you don’t need any Javascript and have no side-effects.
Remember
background-positionjust works for HTML elements that have abackground-imageset.