Setting the image button in CSS - image: active

I am trying to replace the submit button with an image by defining it in class="myButton" and changing the styles in CSS. myButton:active does not seem to work when clicked.

Here is my CSS:

 .myButton{ background:url(./images/but.png) no-repeat; cursor:pointer; border:none; width:100px; height:100px; } myButton:active { background:url(./images/but2.png) no-repeat; } 

HTML code:

 <input class="myButton" type="submit" value=""> 
+8
source share
1 answer

Check out the link. You have lost . to myButton . It was a small mistake. :)

 .myButton{ background:url(./images/but.png) no-repeat; cursor:pointer; border:none; width:100px; height:100px; } .myButton:active /* use Dot here */ { background:url(./images/but2.png) no-repeat; } 
+25
source

Source: https://habr.com/ru/post/925996/


All Articles