我剛剛其實前幾天這樣做的一個項目。這裏是我所做的CSS,示例圖像和html。
<style>
.rollover,
.rollover:visited {
background: #FFF url(http://i.stack.imgur.com/yWGMJ.gif) no-repeat scroll left 0px;
border: none;
cursor: pointer;
width: 64px;
height: 27px;
}
.rollover:hover {
background: #FFF url(http://i.stack.imgur.com/yWGMJ.gif) no-repeat scroll left -27px;
}
</style>
<input type="button" class="rollover" name="btn_1" value="1" /><br />
<input type="button" class="rollover" name="btn_2" value="2" /><br />
<input type="button" class="rollover" name="btn_3" value="3" /><br />
<input type="button" class="rollover" name="btn_4" value="4" /><br />
@ user711250您懸停圖片看http://www.alistapart.com/articles/sprites – Samuel 2011-04-26 13:26:42