There's two options I can think of, off-hand:
- css image sprites, or
- placing the
:hover
image in a hidden div
elsewhere in the page.
1, sprites:
For a CSS Sprite, have one background image for the 'home' link, and simply change its position on the :hover
:
#home {
background-image: url(http://example.com/spriteOne.png);
background-repeat: no-repeat;
background-position: 0 100px;
}
#home:hover {
background-position: 0 200px;
}
This does require set heights for the elements with the css-sprite background, though.
2, hidden preloading elements:
#home {
background-image: url(http://example.com/bg.png);
background-repeat: no-repeat;
background-position: 0 100px;
}
#home:hover {
background-image: url(http://example.com/hoverBg.png);
}
#preload,
#preload img {
display: none;
}
<div id="preload">
<img src="http://example.com/hoverBg.png" />
</div>