Forum Moderators: open

Message Too Old, No Replies

Tables

Inner tables inherit parent widths and height

         

Alternative Future

11:46 am on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I have the following table that has an inner table for and SSI iterate tag. If you have a look at the view produced below you shall see that the inner td's dont match the height and width of their parent elements, my question, is there a way to get them matching in both height and width?

<table cellpadding=0 cellspacing=0 style="border: 1px solid #000" width="500">
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Header1</td>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Header2</td>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Header3</td>
<td style="border-bottom: 1px solid #000">Header4</td>
</tr>
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data belonging to header1</td>
<td colspan=2>
<table cellpadding=0 cellspacing=0>
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data</td>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data</td>
</tr>
</table>
</td>
<td style="border-bottom: 1px solid #000">Data belonging to header4</td>
</tr>
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data belonging to header1</td>
<td colspan=2>
<table cellpadding=0 cellspacing=0>
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data belonging to header2</td>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data belonging to header3</td>
</tr>
</table>
</td>
<td style="border-bottom: 1px solid #000">Data belonging to header4</td>
</tr>
</table>

Many thanks in advance,

-George

tedster

3:42 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Adding style="width:100%" to the nested table element gets the width to behave for me. The height is another deal altogether.

Alternative Future

3:50 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks tedster,

Yeah the height is a PITA...

-George

tedster

4:52 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can't you use a colspan=2 -- for Header 2 and the cell BELOW where you're trying to nest a second table? Then you don't need to nest, you can just have two width:50% <td> elements.

Alternative Future

9:41 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi tedster,

>>Can't you use a colspan=2 -- for Header 2 and the cell BELOW where you're trying to nest a second table

Sorry I dont fully understand what you are suggesting here?

The reason for the current layout is so that I can iterate round the inner tds with repeated data belonging to the parent table row.
So it would look something like this:
<td colspan=2>
<table cellpadding=0 cellspacing=0>
<%for(i = 0; i == size; i++){%>
<tr>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data relating to parent tr</td>
<td style="border-right: 1px solid #000;border-bottom: 1px solid #000">Data relating to parent tr</td>
</tr>
<%}%>
</table>
</td>
Would what you are suggesting fit in with this?

Again thanks for your help...

-George