2

I am trying to add button pressed effect to a button with an image. Here is the css

input.happy {
   background-image url(/img/happy.png)
   background-color transparent
   background-repeat no-repeat
   border none
   width 64px
   height 64px
   margin 10px
  cursor pointer
  border-radius:8px
  -moz-border-radius:8px
  -webkit-border-radius:8px
  box-shadow: 0px 3px 5px #000
  -moz-box-shadow: 0px 3px 5px #000
  -webkit-box-shadow: 0px 3px 5px #000
}

input.happy:hover { 
  position:relative
  top 3px
  color #fqq
  box-shadow none
  -moz-box-shadow none
  -webkit-box-shadow none
}

The effect is shown only on hover. How can I change it so that it is shown when it is clicked. I added something like

   .pressed { 
      position:relative
      top 3px
      color #fqq
      box-shadow none
      -moz-box-shadow none
      -webkit-box-shadow none
    }

and changed the class to .pressed on click. But it is not working. Any suggestions

2
  • 4
    Why are all your properties missing the : symbol/operator? Commented Jan 27, 2013 at 4:37
  • 2
    You want the :active selector. Commented Jan 27, 2013 at 4:37

1 Answer 1

5
input.happy:active {
     background-color:red
}
Sign up to request clarification or add additional context in comments.

Comments

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.