Reputation: 2441
change button image onclick then return to original image after click
<style>
img.button-send {
background: url(img/agentsprite.png) 0 0;
width:87px;
height:34px;
opacity:0;
}
img.button-send:active {
background: url(img/agentsprite.png) 34 174;
width:87px;
height:34px;
}
</style>
<button type="submit">
<img class="button-send" src="img/img_trans.gif" width="1" height="1" />
</button>
i'm using a sprite for this, and it seems that it won't go to that image position when i click it, is there any way for this to work ? i wan't to have a button effect for this field when pressed.
Upvotes: 0
Views: 5833
Reputation: 32182
...........................
hi now used to px value in your background-position
image
as like this
img.button-send:active {
background: url(img/agentsprite.png) 34px 174px;
}
or you can used this also
img.button-send:active {
background-position:34px 174px;
}
px
value according to your design
Upvotes: 3