Tables are defined using the TABLE tag as follows:
Here is a description of each of the attributes of the table tag:
- BGCOLOR
- Assigned either a predefined colour name, or the hexadecimal value of the desired colour for the background of the entire table.
- HEIGHT
- Assigned the number of pixels in height the table must occupy on the page
- WIDTH
- Assigned either the number of pixels in width the table must occupy on the page, or the percentage of the width of the window
- BORDER
- Assigned the number of pixels wide to draw a border around the table
- HSPACE
- Assigned the number of pixels of space to provide between the right and left of the table and surrounding objects
- VSPACE
- Assigned the number of pixels of space to provide between the top and bottom of the table and surrounding objects
- ALIGN
- Assigned either RIGHT or LEFT (default) to position the table at the right or left margin of the page
- CELLPADDING
- Assigned the number of pixels of space between the edges of each cell and the cell's contents
- CELLSPACING
- Assigned the number of pixels of space between each cell in the table
A caption may be added to a table using the CAPTION tag as follows:
Sample Table Here is a description of each of the attributes of the caption tag:
- ALIGN
- Assigned either BOTTOM or TOP (default) to position the caption at either the bottom or top of the table. Do not place the CAPTION inside any of the TR, TH or TD tags!
All of the table parts are contained with rows. So each row of the table is defined as follows:
The attributes of the row tag are:
- BGCOLOR
- Assigned either a predefined colour name, or the hexadecimal value of the desired colour for the background of the entire row.
- ALIGN
- Assigned either LEFT (default), CENTER or RIGHT to position the contents of each cell within the row at either the left, center, or right of their respective cells within the row.
- VALIGN
- Assigned either BASELINE, BOTTOM or MIDDLE (default) or TOP to position the contents of each cell either the bottom (baseline), middle (vertically) or top of thetheir respective cells within the row.
Column headings are defined as follows:
Each of the attributes of the column headings are:
- BGCOLOR
- Assigned either a predefined colour name, or the hexadecimal value of the desired colour for the background of the individual heading cell.
- ALIGN
- Assigned either LEFT (default), CENTER or RIGHT to position the contents of the heading cell within the row at either the left, center, or right of their respective cells within the row.
- VALIGN
- Assigned either BASELINE, BOTTOM or MIDDLE (default) or TOP to position the contents of each cell either the bottom (baseline), middle (vertically) or top of the their respective cells within the row.
- COLSPAN
- Assigned the number of columns in width this cell occupies
- ROWSPAN
- Assigned the number of rows in height this cell occupies
- NOWRAP
- No value assigned, specifies that thhe text within the cell are not tbe broken (no word wrap)
Individual cells are defined as follows:
Each of the attributes of the table cells are:
- BGCOLOR
- Assigned either a predefined colour name, or the hexadecimal value of the desired colour for the background of the individual cell.
- ALIGN
- Assigned either LEFT (default), CENTER or RIGHT to position the contents of the cell within the row at either the left, center, or right of their respective cells within the row.
- VALIGN
- Assigned either BASELINE, BOTTOM or MIDDLE (default) or TOP to position the contents of each cell either the bottom (baseline), middle (vertically) or top of the their respective cells within the row.
- COLSPAN
- Assigned the number of columns in width this cell occupies
- ROWSPAN
- Assigned the number of rows in height this cell occupies
- NOWRAP
- No value assigned, specifies that thhe text within the cell are not tbe broken (no word wrap)
All together, the table definition looks like this:
Sample Table Col 1 Col 2 Item 1 This is some text Item 2 This long text that is supposed to wrap when it exceeds the width of the cell. It should look different than the cell above it. And the table displays like this, with the text that follows it wrapping around to the left, the same as an image with the ALIGN attribute set to RIGHT:
Sample Table Col 1 Col 2 Item 1 This is some text Item 2 This long text that is supposed to wrap when it exceeds the width of the cell. It should look different than the cell above it.