Add image to input as background - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

Add image to input as background

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.my-input {<!-- w w  w  .  j  av a 2 s.com-->
   background:linear-gradient(to right, green 3px, transparent 3px),
   url('http://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
   background-position:right center;
   background-size:31px 31px;
   padding-right:31px;
}
</style> 
 </head> 
 <body> 
  <input class="my-input" type="text">  
 </body>
</html>

Related Tutorials