HTML Form How to - Resize inline image to same height of input element








Question

We would like to know how to resize inline image to same height of input element.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--from w w  w. j a v a2 s .co m-->
  vertical-align: top;
}
</style>
</head>
<body>
  <div style="display: table; margin: 0 auto; margin-top: 10px">
    <input id="searchip" type="text" maxlength="30" autofocus="" size="50"
      name="textnew" style="height: 20px" /> 
    <img style="width: 20px;height: 20px"  src="http://www.java2s.com/style/download.png">
  </div>
</body>
</html>

The code above is rendered as follows: