Page Widget How to - Extend the last cell to fill remaining space








Question

We would like to know how to extend the last cell to fill remaining space.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!--  ww w.j  a  v a  2 s  .  c o  m-->
  border: 1px solid;
}

table {
  width: 100%;
  white-space: nowrap;
}

td:last-child {
  width: 100%;
}
</style>
</head>
<body>
  <table>
    <tbody>
      <tr>
        <td>Hello</td>
        <td>Hi</td>
        <td>How do you do</td>
        <td></td>
      </tr>
    </tbody>
  </table>
</body>
</html>

The code above is rendered as follows: