Welcome to WebmasterWorld Guest from 54.159.246.164

Forum Moderators: incrediBILL

Message Too Old, No Replies

Getting a table to scale 100% vertically

Seems to only want to scale the minimum required amount.

   
11:49 pm on Sep 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

Basically what I want to do is get a table, which is inside of a TD (don't ask -- I've tried the rowspan setup and it doesn't like to work for this purpose), to span the entire height of the TD. Here's what I've got so far (color-coded to visualize the elements).

The table doesn't want to stretch to fill the available height. Any ideas why?



<table align="center" width="80%" cellspacing=0 cellpadding=0 border=0> 



<tr>
<td bgcolor=red align=center width="20%">
<img alt='' src='http://example.com/avatar.png' class='avatar avatar-32 photo avatar-default' height='32' width='32' /><br>
<nobr><a href='http://example.com/' rel='external nofollow' class='url'>John Smith</a></nobr>
</td>
<td bgcolor=orange style="padding:0px">
<table width="100%" height="100%" style="margin:0px" bgcolor=blue cellspacing=0 cellpadding=0>
<tr>
<td>
blah blah blah
</td>
</tr>
<tr>
<td bgcolor=black valign=bottom height=20>
Delete Edit etc.
</td>
</tr>
</table>
</td>
</tr>


</table>
11:01 pm on Sep 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no "height" attribute for <table>.

If the height of the <td> is fixed, try setting style="height:100%" on the table.


As a friendly suggestion— the code you posted is rather inconsistent, mixing HTML attributes and inline CSS, single quotes vs double quotes vs no quotes, using the non-standard <nobr> tag while omitting standard ones like <tbody>. Overall, this can make things rather difficult to debug, especially since an unbalanced tag or even a missing character can "break" a page badly. I would recommend choosing and sticking to a coding style suitable for the DOCTYPE you're using (and I hope I do not presume too much to presume you have set a proper DOCTYPE).