HTML Element Style How to - Set a td's width to 0








Question

We would like to know how to set a td's width to 0.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!--   w  ww .  j a  v  a2s  .  c o  m-->
  background-color: red;
  padding: 0;
  margin:0;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>a</td>
      <td></td>
      <td>a</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: