Often, it is helpful to present information in a more structured manner than a list. Tables can display this information in rows and columns. The tables are defined as series of rows.
A table must follow the rules below:
Here is an example of an HTML table:
<TABLE BORDER="1">
<CAPTION>This is the title of the table</CAPTION>
<TR>
<TH> Title A1 </TH>
<TH> Title A2 </TH>
<TH> Title A3 </TH>
<TH> Title A4 </TH>
</TR>
<TR>
<TH> Title B1 </TH>
<TD> Value B2 </TD>
<TD> Value B3 </TD>
<TD> Value B4 </TD>
</TR>
</TABLE>
The results of this code:
| Title A1 | Title A2 | Title A3 | Title A4 |
|---|---|---|---|
| Title B1 | Value B2 | Value B3 | Value B4 |
| Attribute | Tags it applies to | Value | Visual Effect |
|---|---|---|---|
| ALIGN | THEAD TBODY TH TR TD |
CENTER LEFT RIGHT JUSTIFY |
centred Left Right Justified |
| CAPTION | TOP BOTTOM |
Above Below |
|
| VALIGN (vertical alignment) |
THEAD TBODY TH TR TD |
TOP MIDDLE BOTTOM |
Top Middle Bottom |
| BORDER=n | TABLE | Border size | |
| CELLPADDING=n | TABLE | Leaves n pixels of space between cell contents and border | |
| CELLSPACING=n | TABLE | Thickness of the space in between cells | |
| FLOAT | TABLE | RIGHT LEFT |
Position of text that follows </TABLE> |
| COLS=n | TABLE | Number of columns | |
| FRAME (controls individual table frame elements) |
TABLE | NONE top BOTTOM TOPBOT SIDES ALL |
None Above Bottom All on top On the sides All |
| RULES (controls cell grid elements) |
TABLE | NONE BASIC ROWS COLS ALL |
None basic Line Column All |
| COLSPAN | THEAD TBODY TH TR TD |
Makes cells fill multiple adjacent columns | |
| ROWSPAN | THEAD TBODY TH TR TD |
Makes cells fill multiple adjacent rows |