Forum Moderators: open
I use Front Page and frequently have tables within tables. If I have a large TABLE of 100 pixels wide, can I insert two smaller tables of 50 pixels each, or does each side of each table take up pixel spaces as well that I must allow for when inserting the two smaller tables?
I would go with Corey's suggestion and manage cells rather than tables within tables. Many times, people nest tables to achieve certain border/visual effects. While this is visually appealing, it creates an html nightmare and causes problems with some browsers.
In working with cells to achieve what you want, you'd end up with something like this...
<table border="0" width="100">
<tr>
<td width="50"> </td>
<td width="50"> </td>
</tr>
<tr>
<td width="50"> </td>
<td width="50"> </td>
</tr>
</table>
<table border="0" width="100">
<tr>
<td width="50"> </td>
<td width="50"> </td>
</tr>
<tr>
<td width="50"> </td>
<td width="50"> </td>
</tr>
</table>
The way I would do it..
- I would recommend using percentages for the inside cells. That way, if you resize the outside table width to 150 or 75, the inside cells resize automatically. I often do this with whole web pages, where there's one outside table that's 730 pixels wide, and all the other nested cells & tables are based on percentages.
- You only need to designate the "width" attribute for the first row of cells. Those width values will automatically propagate the the other rows.
- I think it's a good idea to use comments to designate the matching starting and ending table tags. That way, as you have more & more nested tables, you know which tag matches which.
So my modified version would be..
<!--- START: 2 Column Table Example --->
<table width="100" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<!--- END: 2 Column Table Example --->