Tables

Sr.No.
Topics
1

Table Tags

2
General Table Format
3
Tables for Nontabular Information

 

General Table Format

The general format of a table looks like this:

<TABLE>
<!-- start of table definition -->

<CAPTION> caption contents </CAPTION>   
<!-- caption definition -->
<TR>  
<!-- start of header row definition -->
    <TH> first header cell contents </TH>    
    <TH> last header cell contents </TH>    
</TR> 
<!-- end of header row definition -->

<TR>  
<!-- start of first row definition -->
    <TD> first row, first cell contents </TD>
    <TD> first row, last cell contents </TD>    
</TR> 
<!-- end of first row definition -->

<TR>  
<!-- start of last row definition -->
    <TD> last row, first cell contents </TD>
    <TD> last row, last cell contents </TD>    
</TR> 
<!-- end of last row definition -->

</TABLE>
<!-- end of table definition -->

You can cut-and-paste the above code into your own HTML documents, adding new rows or cells as necessary.

The <TABLE> and </TABLE> tags must surround the entire table definition. The first item inside the table is the CAPTION, which is optional. Then you can have any number of rows defined by the <TR> and </TR> tags. Within a row you can have any number of cells defined by the <TD>...</TD> or <TH>...</TH> tags. Each row of a table is, essentially, formatted independently of the rows above and below it. This lets you easily display tables like the one above with a single cell, such as Table Attributes, spanning columns of the table.