HTML Tables Tutorial

Page 16 - <td> height


By default a table cell is only as tall as its content. Sometimes, though, it is desired to set the height of a specific table cell. We can do so with the attribute height in the <td> tag. This is not often used, but sometimes can be helpful. Note what happens to the other cell in the row with the heightened <td>.

What you must remember is:

A cell is as tall as the highest cell in its row, and as wide as the widest cell in its column.


<table border="1">
   <tr>
      <td>Cell #1</td>
      <td>Cell #2</td>
   </tr>
   <tr>
      <td>Cell #3</td>
      <td>Cell #4</td>
   </tr>
</table>
=
Cell #1 Cell #2
Cell #3 Cell #4

<table border="1">
   <tr>
      <td>Cell #1</td>
      <td>Cell #2</td>
   </tr>
   <tr>
      <td height="100">Cell #3</td>
      <td>Cell #4</td>
   </tr>
</table>
=
Cell #1 Cell #2
Cell #3 Cell #4
(note that cell 4 increases in height also)
 
 
MPF.com Site Map