0

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.

1 Answer 1

3

...........................

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

Sign up to request clarification or add additional context in comments.

2 Comments

oh so that's what i'm missing'
it works now gotta have to wait for 10mins before i can accept your ans

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.