Friday, August 28

Setting height of a div inside a td to 100%

Recently came across this issue in a table based layout (old code) where there was an empty div which needed to fit to the height of the td. What would happen now is the div would take up just as much height as the content inside it.

Searching through various forums (read : stackoverflow), I could not get a sturdy solution, however it appears we need to apply the div's parent a height of 100%. However doing so also did not work in my case considering that there many levels of cascading table's and td's. So to fix the issue, what i did was gave an explicit height of 1 to the most parent td.

<td class="parent" height="1" width="100%">
   <table ....>     
      <!-- more code here-->
  </table>
</td>

Be the first one to Comment!!!

Post a Comment