I need ...">

How to make div inside td stretch?

I have a table like:

<table> <tr> <td>...</td> <td><div class="stretch"></div></td> </tr> </table> 

I need .stretch match td height. The div is currently at height 0. What am I missing?

+6
html css
source share
3 answers

td should have the given size, then you set the height of the div: 100%; or inherit pretty much the same and you will be good to go

+6
source share
 .stretch { height: 100%; } 
+1
source share

This should work

 <table style="width: 200px; height: 200px"> <tr> <td style="border: thin solid #FF0000; height:200px"> <div style="border: thin solid #0000FF; width:100%; height:100%;"> </div> </td> </tr> </table> 
0
source share

All Articles