CSS: Image Rollover

By Xah Lee. Date: . Last updated: .

This page shows how to do image rollover with CSS.

Here is a image rollover. Hover your mouse over it.

Code

<div class="xroll6488"></div>
.xroll6488 {
 width: 128px;
 height: 128px;
 background: url("i/tile_A.png");
 &:hover {
  background: url("i/tile_B.png");
 }
}

The trick is using the :hover

Image Rollover

CSS. Background