HTML Element Style How to - Text-align on a table cell td








Question

We would like to know how to text-align on a table cell td.

Answer


<!DOCTYPE html>
<html>
<head>
</head><!--from   w  ww . j  a  v a  2 s .  co m-->
<body>
  <div style="text-align: right;">
    <table style="display: inline-block">
      <tbody>
        <tr>
          <td></td>
          <td>one</td>
          <td>two</td>
        </tr>
      </tbody>
    </table>
  </div>
</body>
</html>

The code above is rendered as follows: