HTML Element Style How to - Align image in table td








Question

We would like to know how to align image in table td.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!--  w  w  w. j a va  2s  . c  om-->
  text-align: center;
  vertical-align: middle;
}
td {
  height: 800px;
  border: 1px solid #f00;
  width: 800px;
}
</style>
</head>
<body>
  <table>
    <tbody>
      <td><img src="http://www.java2s.com/style/download.png" /></td>
    </tbody>
  </table>
</body>
</html>

The code above is rendered as follows: