CSS Property Value How to - text-align: center; Table cell text is aligned slightly to the left of the center








Question

We would like to know how to text-align: center; Table cell text is aligned slightly to the left of the center.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!--from   w w  w .j  a v a 2s  . c om-->
  border: 1px solid #000;
  padding: 20px;
  text-align: center;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <td>39</td>
      <td>74</td>
    </tr>
    <tr>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <td>94</td>
      <td>0</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: