Jump to content

A better, more flexible alternative to JavaScript rollover images


lAZLf

Recommended Posts

I wanted everyone to know that there is a better alternative to JavaScript rollover images that uses simple CSS.

 

HTML:

<div class="rolloverdiv">
      <a href="#"  class="rolloverimg"></a>
</div>

 

the CSS:

.rolloverdiv {
      height:150px;
      width: 150px;
}

.rolloverimg {
      background: url(imgname.extension);
      width:100%;
      height:100%;
      display:block;
      cursor: pointer;
}

.rolloverimg:hover {
      background: url(secondimgname.extension);
}

 

This should be a healthier, simpler alternative to JavaScript rollover images.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.