
Tables
- Tables display data in guess what tabular format!
- Used for things that are really tables of data.
- Used to arrange stuff that we wouldn't normally think of as a table.
- Style sheets can be used instead.
- <table> <tr> <td> ... </td> ... </tr> </table>
[ Simple Table ]
- A table is a series of rows (<tr> ... </tr>).
- Each row is a series of data items (<td> ... </td>).
- Each data section may contain other markup.
- Headers and captions. [ Like This ]
- <th> ... </th> is like <td> ... </td>, but
formatted differently.
- <caption> ... </caption> must be the first thing
inside the <table> ... </table>
- <table> tag attributes control the table as a whole.
[ Table Alignment and Borders ]
- align attributes, left, right and center,
like images.
- width also like images. The height attribute is not
standard, but it usually works.
- border specifies the border width, default zero.
- <table> cell spacing attributes.
[ Padding ]
- cellpadding space between content and cell border.
- cellspacing space between cells.
- Alignment in <tr> and <td>.[ Cell Alignment ]
- align: left, right, center
justify and char. Char requires a char=
or charoff= attribute.
- valign: top, middle, bottom and baseline.
- Spanning. A data item spanning multiple rows and columns,
colspan and rowspan in <td>.
[ Spanning ]
- Tables may appear as entries in tables. [ Nested tables ].
- Table entries may contain any XHTML.
- Can give relatively precise control over layout.
- Background colors. [ Colorful Tables ]
- The bgcolor attribute can be given to rows, data items,
or the whole table.
- Space between items will not be filled with the row or
item color. Very often, use cellspacing="0" with
colors.
- Text will wrap around aligned tables. [ Wrapping ]
- Similar to images.
- Can be used to create an insert in a larger text.
- Grouping columns. <colgroup>...<col /> </colgroup>.
[ Column Groups ]
- Supported by IE; not much else.
- Each <colgroup> ... </colgroup> defines a group of columns.
- May contain <col /> items to control individual columns.
- The number of columns <colgroup> controls is:
- The number of <col /> tags it contains, or, if empty,
- The span attribute of <colgroup>
- Control of a cell by most specific container.
- The attributes of <colgroup> control all cells in the
column.
- The attributes of <col /> control that column and will
override the same attribute in <colgroup>.
- Attributes of <tr> and then <th> or <td> will
override <col />.
- The <col /> may contain a span attribute to allow it
to control several columns.
- The <colgroup>, if present, must follow the <caption>,
if present, or the <table> otherwise.
- Table sections: Head, foot and body.
[ Row Groups ]
- Tags enclose groups of rows: <thead>, <tbody>,
<tfoot>.
- The order is <thead>,
<tfoot>, <tbody>.
- Must use all three,or none.
- Must follow the any <colgroup>
- Applies alignment and color attributes which apply to all
effected slots.
- Table frame attribute: void, above, below,
hsides, vsides, lhs, rhs, box or border.
Interacts with the border attribute.