This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

HTML Coding

Tables: Subtables

Note: The HTML pages are out-of-date and will not be updated.

Cells within a table can actually contain other tables. In order to build a table within a table, place the entire code for the subtable within the code for the appropriate cell. Notice that the other cells in the table are affected by the height and width of the subtable. In the second example below, cell padding is used to place space between the subtable border and the cell border; spacing is automatically added to each of the other cells as well.

return to topA Table With a Subtable in One Cell

Red Green
Blue Black
  Tan Peach
Orange Yellow Purple  

<TABLE BORDER=1>
<TR>
<TD>

<TABLE BORDER=1>
<TR>
<TD>Red<TD>
<TD>Green<TD>
</TR>
<TR>
<TD>Blue<TD>
<TD>Black<TD>
</TR>
</TABLE>

</TD>
<TD>&nbsp;</TD>
<TD>Tan</TD>
<TD>Peach</TD>
</TR>
<TR>
<TD>Orange</TD>
<TD>Yellow</TD>
<TD>Purple</TD>
<TD>&nbsp;</TD>
</TR>
</TABLE>


return to topA Table With a Subtable and Adjusted Borders and Cell Padding

Red Green
Blue Black
Tan Peach
Orange Yellow Purple

<TABLE BORDER=4 CELLPADDING=3>
<TR>
<TD>

<TABLE BORDER=1>
<TR>
<TD>Red<TD>
<TD>Green<TD>
</TR>
<TR>
<TD>Blue<TD>
<TD>Black<TD>
</TR>
</TABLE>

</TD>
<TD>Tan</TD>
<TD>Peach</TD>
</TR>
<TR>
<TD>Orange</TD>
<TD>Yellow</TD>
<TD>Purple</TD>
</TR>
</TABLE>

Excellence. Our Measure. Our Motto. Our Goal.