Page Widget How to - Align table text left








Question

We would like to know how to align table text left.

Answer


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of setting table dimension</title>
<style type="text/css">
table {<!--from  ww w. j a  v  a 2 s .  c o m-->
  width: 300px;
  text-align: left;
}
</style>
</head>
<body>
  <table border="1">
    <caption>User Info</caption>
    <tr>
      <th>Name</th>
      <th>Email</th>
    </tr>
    <tr>
      <td>John</td>
      <td>john@mail.com</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: