html - How to add background image for input type="button"? -


i've been trying change background image of input button through css, doesn't work.

search.html:

<body>     <form name="myform" class="wrapper">         <input type="text" name="q" onkeyup="showuser()" />         <input type="button" name="button" value="search" onclick="showuser()" class="button"/>          <p>              <div id="txthint"></div>          </p>     </form> </body> 

search.css:

.button {     background-image: url ('/image/btn.png') no-repeat;     cursor:pointer; } 

what wrong?

even inline-ing css didn't seem work.

you need type without word image.

background: url('/image/btn.png') no-repeat;

tested both ways , 1 works.

example:

<html>     <head>         <style type="text/css">             .button{                 background: url(/image/btn.png) no-repeat;                 cursor:pointer;                 border: none;             }         </style>     </head>     <body>         <input type="button" name="button" value="search" onclick="showuser()" class="button"/>         <input type="image" name="button" value="search" onclick="showuser()" class="button"/>         <input type="submit" name="button" value="search" onclick="showuser()" class="button"/>     </body> </html> 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -