Thank you for the feedback! Removing the table { height: 100%; } did not work because it doesn't stretch the table to the bottom of the page. This stretching is what I wanted, but I think this is also what caused the overly inflated <tr> which this question refers to.

The solution to this was more of an accident:

<tr style="height: 0;">
  ...
</tr>

With this, the row shrinks to the size of its content, while the table still stretches to the bottom of the page. Not sure if this is a "healthy" solution, but is sure works.

Answer from Jens on Stack Overflow
🌐
SitePoint
sitepoint.com › html & css
Html table resize height and td height - HTML & CSS - SitePoint Forums | Web Development & Design Community
November 10, 2010 - Hi, I have a html table and I am unable to change his height value to fit the browser window height though it was set to height: 100% in CSS; so to change the size dynamically I have done something with javascript change the height of tbody, but doing this the height of each td has been stretched; ...
🌐
HTML.com
html.com › attributes › td-width
Attributes for WIDTH = "width expression"HEIGHT = "height expression"
January 24, 2020 - <table> <tr> <th>Thin</th> <th>Really Really Really Wide</th> </tr> <tr> <td width="50%">Little</td> <td width="50%">Lots and lots and lots and lots of content, so much that we might even need a line break.</td> </tr> </table> In both cases, your browser should give each column the same width. However, the first table should auto-size to fit the available space while the second will have a fixed width.
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-td-height-attribute
HTML &lt;td&gt; height Attribute - GeeksforGeeks
July 11, 2025 - <!DOCTYPE html> <html> <head> <title>HTML td height Attribute</title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML td height Attribute</h2> <table border="1" width="500"> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td height="50">BITTU</td> <td height="50">22</td> <td height="50">CSE</td> </tr> <tr> <td height="100">RAKESH</td> <td height="100">25</td> <td height="100">EC</td> </tr> </table> </body> </html>
Top answer
1 of 7
279

If you give your TD a height of 1px, then the child div would have a heighted parent to calculate it's % from. Because your contents would be larger then 1px, the td would automatically grow, as would the div. Kinda a garbage hack, but I bet it would work.

2 of 7
47

CSS height: 100% only works if the element's parent has an explicitly defined height. For example, this would work as expected:

td {
    height: 200px;
}

td div {
    /* div will now take up full 200px of parent's height */
    height: 100%;
}

Since it seems like your <td> is going to be variable height, what if you added the bottom right icon with an absolutely positioned image like so:

.thatSetsABackgroundWithAnIcon {
    /* Makes the <div> a coordinate map for the icon */
    position: relative;

    /* Takes the full height of its parent <td>.  For this to work, the <td>
       must have an explicit height set. */
    height: 100%;
}

.thatSetsABackgroundWithAnIcon .theIcon {        
    position: absolute;
    bottom: 0;
    right: 0;
}

With the table cell markup like so:

<td class="thatSetsABackground">  
  <div class="thatSetsABackgroundWithAnIcon">    
    <dl>
      <dt>yada
      </dt>
      <dd>yada
      </dd>
    </dl>
    <img class="theIcon" src="foo-icon.png" alt="foo!"/>
  </div>
</td>

Edit: using jQuery to set div's height

If you keep the <div> as a child of the <td>, this snippet of jQuery will properly set its height:

// Loop through all the div.thatSetsABackgroundWithAnIcon on your page
$('div.thatSetsABackgroundWithAnIcon').each(function(){
    var (this);

    // Set the div's height to its parent td's height
    $div.height($div.closest('td').height());
});
  
🌐
Experts Exchange
experts-exchange.com › questions › 20388525 › Making-div-fill-td-cell-using-height-100.html
Solved: Making div fill td cell using height:100% | Experts Exchange
November 2, 2002 - The way you have that written, you are telling the browser to size the div and the td to the content. That is what "auto" means. 100% in this case represents the height of the content, and that is what you should get.
🌐
Litmus
litmus.com › community › discussions › 6715-full-height-content-of-table-cell
Full Height Content of Table Cell > Litmus
July 26, 2017 - <table> <tr> <td style="padding:0px;"><span style="height:100%; width:5px; background-color:white;display:block;overflow:auto">&nbsp;</span></td> <td>Some content</td> <td>Some more content</td> </tr> </table>
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-fix-the-height-of-rows-in-the-table
How to fix the height of rows in the table? - GeeksforGeeks
Note that the height is fixed regardless of content size, and any overflow will be hidden or managed depending on the CSS settings. ... <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>How to fix height of table tr?</title> <style> ...
Published   September 17, 2024
Find elsewhere
🌐
Tek-Tips
tek-tips.com › home › forums › software › programmers › web development › html, xhtml & css
height on td not working? | Tek-Tips
July 29, 2010 - Thread starter 1DMF · Start date Jul 29, 2010 · Status · Not open for further replies. Jul 29, 2010 · #1 · Jan 18, 2005 · 8,795 · GB · Hi, Why doesn't this work... Code: td { display:block; height:40px; overflow:hidden; } The td cell still expands to fit the content.
🌐
W3Schools
w3schools.com › html › html_table_sizes.asp
HTML Table Sizes
HTML tables can have different sizes for each column, row or the entire table. Use the style attribute with the width or height properties to specify the size of a table, row or column.
Top answer
1 of 4
89

Define width of .absorbing-column

Set table-layout to auto and define an extreme width on .absorbing-column.

Here I have set the width to 100% because it ensures that this column will take the maximum amount of space allowed, while the columns with no defined width will reduce to fit their content and no further.

This is one of the quirky benefits of how tables behave. The table-layout: auto algorithm is mathematically forgiving.

You may even choose to define a min-width on all td elements to prevent them from becoming too narrow and the table will behave nicely.

table {
    table-layout: auto;
    border-collapse: collapse;
    width: 100%;
}
table td {
    border: 1px solid #ccc;
}
table .absorbing-column {
    width: 100%;
}
<table>
  <thead>
    <tr>
      <th>Column A</th>
      <th>Column B</th>
      <th>Column C</th>
      <th class="absorbing-column">Column D</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Data A.1 lorem</td>
      <td>Data B.1 ip</td>
      <td>Data C.1 sum l</td>
      <td>Data D.1</td>
    </tr>
    <tr>
      <td>Data A.2 ipsum</td>
      <td>Data B.2 lorem</td>
      <td>Data C.2 some data</td>
      <td>Data D.2 a long line of text that is long</td>
    </tr>
    <tr>
      <td>Data A.3</td>
      <td>Data B.3</td>
      <td>Data C.3</td>
      <td>Data D.3</td>
    </tr>
  </tbody>
</table>

2 of 4
46

demo - http://jsfiddle.net/victor_007/ywevz8ra/

added border for better view (testing)

more info about white-space

table{
    width:100%;
}
table td{
    white-space: nowrap;  /** added **/
}
table td:last-child{
    width:100%;
}

    table {
      width: 100%;
    }
    table td {
      white-space: nowrap;
    }
    table td:last-child {
      width: 100%;
    }
<table border="1">
  <thead>
    <tr>
      <th>Column A</th>
      <th>Column B</th>
      <th>Column C</th>
      <th class="absorbing-column">Column D</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Data A.1 lorem</td>
      <td>Data B.1 ip</td>
      <td>Data C.1 sum l</td>
      <td>Data D.1</td>
    </tr>
    <tr>
      <td>Data A.2 ipsum</td>
      <td>Data B.2 lorem</td>
      <td>Data C.2 some data</td>
      <td>Data D.2 a long line of text that is long</td>
    </tr>
    <tr>
      <td>Data A.3</td>
      <td>Data B.3</td>
      <td>Data C.3</td>
      <td>Data D.3</td>
    </tr>
  </tbody>
</table>

🌐
SitePoint
sitepoint.com › html & css
How to fit the height and width? - HTML & CSS - SitePoint Forums | Web Development & Design Community
January 6, 2016 - The simplest way to get the full viewport heights is to use display:table and display:table-cell so that cells always match height of each other (as tables always do) and then you set html and body to height:100% and the table to height:100%. Tables ...
🌐
CodePen
codepen.io › danggun › pen › jxyXxj
fill td height
Minimize HTML Editor · Fold All · Unfold All · <table> <tr> <td class="td100"> <div>td 100%</div> </td> <td class="td1"> <div>td 1px</div> </td> <td class="divBig"> <div>big</div> </td> </tr> </table> ! CSS Options · Format CSS · View Compiled CSS · Analyze CSS · Maximize CSS Editor · Minimize CSS Editor · Fold All · Unfold All · table tr td div { height:100%; } .td100 { height:100%; background-color:#04ff10; } .td100 > div { background-color:#adffb1; } .td1 { height:1px; background-color:#0004ff; } .td1 > div { background-color:#bfc0ff; } .divBig > div { height:100px; background-color:#bffffd; } !
🌐
W3Schools
w3schools.com › css › css_table_size.asp
CSS Table Size (Width and Height)
The CSS height property is used to set the height of a table. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
Stack Overflow
stackoverflow.com › questions › 38757324 › html-table-fit-cell-height-to-contents-valign-top
css - HTML table fit cell height to contents valign top - Stack Overflow
March 3, 2019 - <table border="1" cellspacing="0" cellpadding="0"> <tr> <td>&nbsp;</td> </tr> <tr> <td valign="top" width="65%"> This is my 1st cell </td> <td valign="top" width="35%" height="300" rowspan="7" align="right"> This is long cell </td> </tr> <tr> <td valign="top" width="65%">This is my 2nd cell</td> </tr> <tr> <td valign="top" width="65%" rowspan="5"> <!-- CHANGED HERE --> This is my 3rd cell </td> </tr> </table>
🌐
Result University
resultuniversity.com › html › html-table-width-height
HTML Table Size: Width & Height of Columns & Rows
<!DOCTYPE html> <html> <head> ... <td>Paris</td> </tr> </table> <p>Here height of the table is set to 100%.</p> </body> </html> ... Keep in mind that setting the height of a table will not change the size of the stuff inside the table. It will just add a height property to the table element, which can cause the content to be hidden if it doesn't fit in the set ...