CSSスプライト用の画像を準備。
- default.png
表示例
index.html
<style>
a.sprite {
line-height:45px;
display:block;
background:url(default.png) no-repeat top left;
}
a.sprite:hover {
background-position: bottom left;
}
a.ok {
text-decoration:none;
}
</style>
<p>画像が表示されない例</p>
<a href="#" class="sprite sample1"></a>
<p>画像が表示されるが、画像に_が入る</p>
<a href="#" class="sprite sample2"> </a>
<p>期待どおりに表示</p>
<a href="#" class="sprite sample3 ok"> </a>