Thursday, December 11, 2014

Using a background image for clear text.

<form action="" method="get">
   <input type="text" name="search" required="required" placeholder="type here"/>
   <input type="reset" value="" alt="clear" />
</form>

<style>

   input[type="text"]
   {
      height: 38px;
      font-size: 15pt;
   }

   input[type="text"]:invalid + input[type="reset"]{
     display: none;
   }

   input[type="reset"]
   {
      background-image: url( http://png-5.findicons.com/files/icons/1150/tango/32/edit_clear.png );
      background-position: center center;
      background-repeat: no-repeat;
      height: 38px;
      width: 38px;
      border: none;
      background-color: transparent;
      cursor: pointer;
      position: relative;
      top: -9px;
      left: -44px;
   }

</style>


Output :)

1)

2)

No comments:

Post a Comment