e1seix Posted November 27, 2008 Share Posted November 27, 2008 rather simple code really, don't think i need to post the full html code. the idea obviously being that when the user hovers over a link, the background image changes to a different image and back again when not hovered over. in Firefox, not a problem - in IE, the hovering background image remains when the user has stopped hovering over the link #advice { float:left;height:150px;width:450px; } #advice a img { background-image:url('/images/advice.jpg');border:none;height:150px;width:450px; } #advice a:hover img { background-image:url('/images/shop.jpg');border:none;height:150px;width:450px; } #shop { float:left;height:150px;width:450px; } #shop a img { background-image:url('/images/shop.jpg');border:none;height:150px;width:450px; } #shop a:hover img { background-image:url('/images/advice.jpg');border:none;height:150px;width:450px; } The actual HTML image (advice_shop.gif) is of course transparent echo '<div id="advice"><a href="/advice/"><img src="/images/transparent/advice_shop.gif" /></a></div>'; echo '<div id="shop"><a href="/shop/"><img src="/images/transparent/advice_shop.gif" /></a></div>'; Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 30, 2008 Share Posted November 30, 2008 for the best affect, I would recommend using one image instead of two images. It is much more clean, and avoids an image flicker between the change. Here is how to do it: http://www.redvodkajelly.com/blog/2007/06/15/css-image-rollovers/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.