The inner table needs to sit inside a cell of the outer table, eg:
<TABLE>
<TR>
<TD>
THIS IS A CELL IN YOUR OUTER TABLE WHICH CONTAINS: <TABLE><TR><TD>THIS TEXT IS INSIDE THE NESTED TABLE</TD></TR></TABLE>
..SO THE COMPLETE INNER TABLE SITS INSIDE ONE CELL OF THE OUTER TABLE. NOW CLOSE THE OUTER TABLE CELL, ETC.
</TD>
</TR>
</TABLE>
One thing I always do to make sure anything I code is opened and closed properly is to write the open and close tags right away at the same time before filling things in between. So to nest a table within a table firstI would do:
<table>
<tr>
<td>
</td>
</tr>
</table>
THEN I'd do my second table inside the same way:
<table>
<tr>
<td>
<table>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
This way I know all my tags are properly closed before I put in anything else. Using comments in the code also helps. These don't show up in the browser, but are helpful for you when looking at the code:
Indenting can be very, very helpful, too. Makes it more readable!:
Code:
<!--Open Main table -->
<table>
<tr>
<td>
<table> <!--Open Sub table -->
<tr>
<td>
inner, inner content
</td>
</tr>
</table> <!--Close Sub table -->
</td>
</tr>
</table> <!--Close Main table -->
For some, it's just being a control freak. For me, it's invaluable to keeping track of pieces.
BHaines advice is dead-on -- build your outer container first until you're happy with it. Then build what goes inside it.
Of course, my advice is that you probably don't need nested tables anyway -- design your page such that you don't need 'em and you'll be a lot happier.
Cheers,
Edward
"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.