Table Data - Table Header - Table Row


HTML tables are organized by rows. Use the <TR> tag to start a table row, and use the </TR> tag to end the row.

Now that you have specified a row, data or headings need to go into the cells that make up a row. The content of a cell is placed between the <TD> tag and the </TD> tag if data is to go into the cell or if a heading is to go into the cell, then the heading is placed between the <TH> tag and the </TH> tag. If you wish to have an empty cell, place the start marker and the end marker right next to each other with no space in between. For example:


<TABLE> 
<CAPTION>Favorite Foods</CAPTION> 
<TR> 
<TH>Italian</TH> 
<TH>Fruits</TH> 
</TR> 
<TR> 
<TD>Lasagna</TD>      <TD>Apples</TD>  </TR>
<TR> 
<TD>Pizza</TD>        <TD>Bananas</TD> </TR>
<TR> 
<TD>Prosciutto</TD>   <TD>Cherries</TD></TR>
<TR> 
<TD>Ravioli</TD>      <TD>Figs</TD>    </TR>
<TR> 
<TD>Spaghetti</TD>    <TD>Grapes</TD>  </TR>
<TR> 
<TD></TD>             <TD>Melon</TD>   </TR>
<TR> 
<TD></TD>           <TD>Nectarines</TD></TR>
<TR> 
<TD></TD>             <TD>Oranges</TD> </TR>
<TR> 
<TD></TD>             <TD>Papaya</TD>  </TR>
</TABLE> 

Would display this table on the user's screen

Favorite Foods
Italian Fruits
Lasagna Apples
Pizza Bananas
Prosciutto Cherries
Ravioli Figs
Spaghetti Grapes
Melon
Nectarines
Oranges
Papaya


The difference between a table data element and a table header element is that the display of the information in the header cell will appear in a bolder type than in a data cell. Also, the default alignment of the information in the header cell is CENTER, while the default alignment of a data cell is LEFT.

How do I change the alignment in my table?


[INDEX] [PREVIOUS] [NEXT PAGE] [CHAPTER 8]

Valid HTML 3.2!