Summary of HTML Table Tags and Selected Attributes

 

 

Tags

 

A <table> is an optional <caption> followed by one or more rows.  Each row is in turn divided into a series of data items (or headers).  The following tags are used in tables.  Each requires a corresponding end (</>) tag.

 

Tag                  Usage

 

<table>            define a table

<caption>         caption

<tr>                 row

<th>                 header cell

<td>                 data cell

 

<th> and <td> are identical, except that headers are bold and centered.

 

 

Attributes

 

<table> attributes include:

 

   border = n

   cellpadding = n

   cellspacing = n

   bgcolor = color

 

<caption> attributes include:

 

   align = top, bottom

 

<tr> attributes include:

 

   bgcolor =  color

 

<th> and <td> have the same attributes, including:

 

   colspan = n

   rowspan = n

   width = n

   align = left, right, center

   bgcolor = color