title: How to fit HTML table row to its content
body: <p>My <code>&lt;table&gt;</code> has three rows and columns, with the last table row like this:</p>
  
  <pre><code>&lt;tr&gt;
   &lt;td colspan="3" align="center" valign="top" style="background-color: #eeeeee;"&gt;
    &lt;hr class="vdivider"&gt;
    &lt;div class="sitemap"&gt;There's an unordered list in here&lt;/div&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Now the odd thing that I can not figure out is that the <code>&lt;tr&gt;</code> is almost twice as high as its content.  Both <code>&lt;hr&gt;</code> and <code>&lt;div&gt;</code> together sit quite nicely aligned to the top of the table row, and then there are almost 150px empty space to the bottom of the table.  Padding and margin and border for all elements are 0, and there is not much other styling to the table or its rows/columns other than this:</p>
  
  <pre><code>html, body, table {
    width: 100%;
    height: 100%;
  }
  </code></pre>
  
  <p>How can I make that table row fit the height of its content, and get rid of the big space at the bottom?  I have assigned the height to the table here to make sure it stretches to the bottom of the window if the window is larger than the table would be.  I assume that is where the overly large <code>&lt;tr&gt;</code> originates.  To compensate for that stretch, I tried to add the extra <code>&lt;tr&gt;</code> above the sitemap with a <code>min-height:100px; max-height:none;</code> but that didn't help.</p>
  
  <p><strong>EDIT</strong> Fixed typos.</p>
  
  <p><strong>EDIT</strong> Maybe a little more background on this.</p>
  
  <pre>
  +--------------------------------+  browser window (html body)
  | +----------------------------+ |
  | |       banner image         | |  there is a banner image here that stretches across the page
  | +----------------------------+ |
  | | css menu bar               | |  a standard CSS menu built from ul
  | +----------------------------+ |  this is where the table starts, it has three columns
  | |  td   |  td           | td | |
  | |       |               |    | |
  | +----------------------------+ |
  | | tr colspan=3 to make space | |  there's column to make space between content above and sitemap below
  | +----------------------------+ |
  | | tr colspan=3 for sitemap   | |  tr from above, the sitemap which stretches way down if table { height: 100%; }
  | +----------------------------+ |
  |                                |  this is the space in large windows when table has no height setting.
  +--------------------------------+
  </pre>