HTML Form How to - Add image to the background of form control








Question

We would like to know how to add image to the background of form control.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!-- w  w  w  . j  a  v a 2 s .  c  om-->
  background:
    url('http://www.java2s.com/style/download.png')
    no-repeat;
  width: 500px;
  height: 400px;
  vertical-align: top;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>
        <form>
          <label>Text: </label> <select><option>---</option></select>
        </form>
      </td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: