Rollover Buttons

Rollover buttons are buttons that swap images when the cursor passes over them. These have been popular for dynamic sites for a long time, but are mostly outdated as there is a superior method for creating rollovers without the use of JavaScript – CSS Sprites.

Some of the flaws of rollover buttons:

Rollover buttons look like this:

Back
Forward
Here is the code for a JavaScript rollover like the two above:

CSS Sprites

CSS Sprites are the better way to create rollovers. They do not use any JavaScript, and rely upon just CSS to slide the background image into or out of view. This button was created with CSS Sprites: click

Pressed Button Effect (With CSS Sprites)

You can also create a 'pressed button' effect with CSS sprites. The second image is merely shifted down by 1 pixel as in this example: click Here is the code for the CSS Sprites above:

 


 

click