calmestghost.com | + share

Use Firefox: Spread Firefox Affiliate Button
bhadaway@gmail.com | subscribe

Socialize: Bryan Hadaway's LinkedIn Page Bryan Hadaway's Twitter Page Bryan Hadaway's Facebook Page Bryan Hadaway's MySpace Page
Signup for HostMonster

Demo:

Code:

CSS

.hov{
display:block;
width:245px;
height:195px;
background:url(‘images/image1.png’)}

.hov:hover{
display:block;
width:245px;
height:195px;
background:url(‘images/image2.png’)}

Change the background URL to your image locations and adjust the width and height appropriately.

XHTML

Change # to whichever URL you wish.

Avoid Flicker on Image Rollover

This happens because the 2nd image only loads on mouseover/hover. We can avoid this by preloading the images(s) and this can still be done non-JavaScript with CSS:

CSS

.preload{display:none}

XHTML

This will preload the images without showing them or messing up your design. Use this method to preload all secondary images (the images to be seen on rollover). This is a much more reliable and lightweight method than the JavaScript alternative.

That’s it. There is certainly more style and techniques you can add, but this is THE most minimal way to create a rollover image effect, if it’s possible to get simpler, let me know.

Enjoy.

Thanks, Bryan

Bookmark and Share
Google Buzz
Tagged with:  

Leave a Reply

What is 12 + 7 ?
Please leave these two fields as-is:

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

    © 2010 BryanHadaway.com. All Rights Reserved. | Theme By: PageLines | Designed By: calmest_ghostDESIGN
    Proudly Powered By: WordPress | Articles (RSS) and Comments (RSS) | Valid XHTML
    preload