The best solution is to put a div inside the cell with the height:

<td style="padding-left:5px;">
  <div style="height: 50px; overflow:hidden;">
      ...
  </div>
</td>

BTW, what is the span for? If you only need it for styling, you can style the cell directly instead.

Answer from RoToRa on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-td-height-attribute
HTML &lt;td&gt; height Attribute - GeeksforGeeks
July 11, 2025 - The HTML <td> height Attribute is used to specify the height of the table cell.
Discussions

TD HEIGHT not working - HTML & CSS - SitePoint Forums | Web Development & Design Community
I’m trying to make the TD HEIGHT to 10 but it won’t budge. Here’s the code: More on sitepoint.com
🌐 sitepoint.com
0
June 18, 2002
html - How to force a TD to be a certain height with CSS? - Stack Overflow
Although some questions similar to this one have been asked before, this one is a little different. I have a table that looks a little something like this: More on stackoverflow.com
🌐 stackoverflow.com
Making div fill td cell using height:100%
Find answers to Making div fill td cell using height:100% from the expert community at Experts Exchange More on experts-exchange.com
🌐 experts-exchange.com
November 2, 2002
object - HTML 'td' width and height - Stack Overflow
The 'height' and 'width' are not supported in HTML5. How can I set a td's width and height while conforming to the HTML5 standard? More on stackoverflow.com
🌐 stackoverflow.com
🌐
W3Schools
w3schools.com › html › html_table_sizes.asp
HTML Table Sizes
Use the style attribute with the width or height properties to specify the size of a table, row or column. To set the width of a table, add the style attribute to the <table> element: ... <table style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </table> Try it Yourself »
🌐
Devguru
devguru.com › content › technologies › html › td-height.html
HTML >> td >> height | DevGuru
The height attribute of <td> is · deprecated in HTML 4.01. The height attribute is · deprecated effective with version 4.0. You are now to use style sheets. You use this attribute to set a minimum height for the cell. This value is an integer number of pixels.
🌐
W3Schools
w3schools.com › tags › tag_td.asp
HTML td tag
The <td> tag defines a standard data cell in an HTML table.
🌐
SitePoint
sitepoint.com › html & css
TD HEIGHT not working - HTML & CSS - SitePoint Forums | Web Development & Design Community
June 18, 2002 - <table width=“100%” border=“1” cellspacing=“0” cellpadding=“0”> <tr> <td rowspan=“2” valign=“top” width=“225”><img src= “images/whatever.gif” width=“225” height=“155” alt=“” /></td> <td height=“10”> </td> </tr>
Find elsewhere
🌐
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 - Percentage heights are unreliable, and table inheritance does not always work correctly. 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.
🌐
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
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>How to fix height of table tr?</title> <style> table { margin-left: auto; margin-right: auto; font-size: 10px; width: 100%; table-layout: fixed; } td { border: 1px solid black; text-align: center; padding: 10px; } tr:nth-child(even) { background-color: green; } </style> </head> <body> <table> <!-- row with fixed height--> <tr height="300px"> <td>Height of this row remains same on varying screen-size</td> <td>Geeks for Geeks</td> <td> Geeks for Geeks is a Computer Science Portal created with the goal of providing well written, well thought and well-explained solutions for selected questions.
Published   September 17, 2024
🌐
Reddit
reddit.com › r/css › setting a block to fill 100% height of cell without defining the height of the cell.
r/css on Reddit: Setting a block to fill 100% height of cell without defining the height of the cell.
November 12, 2023 -

I want the link to fill the entire containing cell, including vertically.

I have basically this:

<table>
<tr>
<td style="padding:0px; border:1px solid green;"><a href="https://google.com" style="display:block; margin:0px; height:100%; border:1px solid red;">Text</a></td>
<td>Multi-Line<br />Text</td>
</tr>
</table>

If I put an explicit height ( height:100px; )on the containing cell then the internal element fills that height. Otherwise I get a gap.

Fiddle: https://jsfiddle.net/3c91Lkpz/

Edit: None of the suggestions quite worked right, so I convinced them to accept a different tack.

Edit 2: Following up for future people. I did find the following.

<style type="text/css">
td.biglink {
  position: relative;
  background-color: #ccc;
}

td.biglink:hover {
  background-color: #eee;
}

td.biglink a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 0;
}
</style>
<table>
 <tr>
  <td class="biglink"><a href="http://www.google.com/">Cell 1<br>second line</a></td>
  <td>Cell 2 no link<br><br><br><br></td>
  <td class="biglink"><a href="http://www.google.com/">Cell 3</a></td>
 </tr>
</table>

The background color change is the cell background, otherwise the ::after background covers the text. You can do a semi-transparent hover if you don't want the cell to do it. The benefit is reducing the need of a class on the cell. The problem is that it still overlays the text.

<style type="text/css">
td {
  position: relative;
}

td a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 0;
}
td a:hover::after {
  background: rgba(170,234,204,0.5);
}
</style>
<table>
 <tr>
  <td><a href="http://www.google.com/">Cell 1<br>second line</a></td>
  <td>Cell 2 No Link<br><br><br><br></td>
  <td><a href="http://www.google.com/">Cell 3</a></td>
 </tr>
</table>
🌐
Marketing Nation
nation.marketo.com › home › product communities › adobe marketo engage › adobe marketo engage › table cell height->outlook rendering->can't figure out correct mso coding
Table cell height-&gt;Outlook rendering-&gt;Can't figure out correct MSO coding | Community
December 2, 2021 - I'm trying to keep my middle row locked at a height of 80px, but I can seem to figure out how do that with the mso conditional coding, spent a lot of time on it but just keep hitting a wall. mso line height rule, the if(mso) code style, but I must be doing something wrong. <!-- 3 Columns with Buttons --> <table class="mktoModule section-multicol" id="module-threecol" mktoname="3 Columns - Buttons" width="100%" cellpadding="0" cellspacing="0" border="0"> <tbody> <tr class="three-col"> <td class="inner" style="background-color:${threecol-bg};padding-top:${threecol-pad-above}px;padding-bottom:${t
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › table
<table> HTML table element - HTML | MDN
2 weeks ago - table, th, td { border: 1px solid black; } table { overflow: auto; width: 100%; max-width: 400px; height: 240px; display: block; margin: 0 auto; border-spacing: 0; } tbody { white-space: nowrap; } th, td { padding: 5px 10px; border-top-width: 0; border-left-width: 0; } th { position: sticky; ...
🌐
Webkit
lists.webkit.org › pipermail › webkit-dev › 2010-June › 013376.html
[webkit-dev] Should Table Cell (TD) children inherit height?
June 29, 2010 - What about > children of a TD tag? If you add an empty div child to a table, should it > fit the whole cell, or should it have a size of 0? > >> > >> > >> <table width="100%" border="0" style="height:100%;"> > >> <tr> > >> <td style="background-color: red;"> > >> <div id="drawing" style="background-color: green;"></div> > >> </td> > >> </tr> > >> </table> > >> > >> > >> WebKit will show you red instead of green because the div does not have > a height of 100%. > >> > >> Now if you make the div's height 100%, you get green.
🌐
Vuetify
vuetifyjs.com › en › components › tables
Table — Vuetify
The table component is a lightweight wrapper around the table element that provides a Material Design feel without a...
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › content › tables
Tables · Bootstrap v5.0
<table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">First</th> <th scope="col">Last</th> <th scope="col">Handle</th> </tr> </thead> <tbody> <tr> <th scope="row">1</th> <td>Mark</td> <td>Otto</td> <td>@mdo</td> </tr> <tr> <th scope="row">2</th> <td>Jacob</td> <td>Thornton</td> <td>@fat</td> </tr> <tr> <th scope="row">3</th> <td colspan="2">Larry the Bird</td> <td>@twitter</td> </tr> </tbody> </table>
🌐
Tailwind CSS
tailwindcss.com › docs › height
height - Sizing - Tailwind CSS
Use h-<number> utilities like h-24 and h-64 to set an element to a fixed height based on the spacing scale: