Annabella's HTML Help .... EZ PRINT!

MORE TABLE ATTRIBUTES

For the full version of this page, go to http://www.annabella.net/tables3.html

ALIGNING DATA

In all previous examples, the position of the data within the cell has been left to the default settings. You can set the alignment of your data within each cell, using the ALIGN (horizontal alignment) and VALIGN (vertical alignment) attributes.

ALIGN and VALIGN are attributes of the TD and TH tags.

align=left / align=center / align=right
The TH default setting is to the center of the cell.
The TD default setting is to the left of the cell.

valign=top / valign=middle / valign=bottom
The TH default setting is to the middle of the cell.
The TD default setting is to the middle of the cell.

If you do not specify the align or valign attributes, then the data will go to the default settings, which will be different depending on whether it is a TD or TH cell.

TR ALIGN

ALIGN is also an attribute of the TR tag.

Instead of specifying the alignment attributes within every cell in a table row, you can preset the alignment for the entire row by specifying ALIGN or VALIGN within the TR tag.

<tr align=right valign=bottom>
<td>data</td>... etc... etc... etc

If you want to have the alignment for one or more of the cells different from the overall TR alignment setting, then simply specify the alignment you wish within that data cell. The TD or TH alignment will over-ride the pre-set TR alignment.

<tr align=right valign=bottom>
<td>data</td>
<td align=center valign=middle>data</td>
<td>data</td>
<td>data</td>
</tr>

ALIGNING THE TABLE

ALIGN is an attribute of the table tag.

This determines the position of your table on the page. You can align your table left, right or center. If you do not specify the alignment,(as in all the previous examples) it will default to the left.

NOTE: When the align=right or align=left attribute is used, the text that follows the table will appear at the side of the table.



COLSPAN

COLSPAN is an attribute of the TD and TH tags.

You can make your data cells span more than one column by using the colspan attribute. This can be added to td or th cells.

colspan is expressed as the number of rows or cells, that you want this particular cell to span.

<table border=5 cellpadding=2 width=65%>
<tr><th colspan=3>Australian Flowers</th></tr>
<tr><td>Waratah</td><td>... etc... etc

CAPTIONS

CAPTION is an attribute of the TABLE tag.

To add a caption to your table, simply insert
<caption> caption text</caption>.
These tags are inserted just after the opening <table> tag.

<table border=5 cellpadding=5 width=50%>
<caption><b>The Beatles!</b><caption>

By changing the tag to <caption align=bottom> caption text </caption>, we can put the caption below the table.

www.annabella.net
© COPYRIGHT 1997-2001     A. RAMSDEN     All Rights Reserved