| Table topic |
Points to note |
| The table tags |
A whole table is enclosed within a pair of TABLE tags. |
| Table rows |
A table is entirely made up of one or more rows, each enclosed
in a pair of TR tags. |
| Table cells |
A table row is entirely made up of one or more table cells,
each enclosed in a pair of TD tags. |
| Heading cells |
An alternative to TD is TH, which normally gives the contents
bold and centred, as at the top of this table. |
|
Table borders
|
Tables may have borders. To have borders you include the
attribute (here border="1") with the number set to
the width of the border you want in pixels. |
| Table colours |
Tables can have background colours, as here
(#eeffff).
Cells can also have background colors:
see more examples of colours in tables on the
borders page.
|
| Cell alignment |
Every table cell can be aligned left (which is the default),
right or center (note the American spelling again). This one is aligned
right, which probably looks very odd. Cells can also have a
valign attribute, which means vertical alignment.
The cell to the left of this one is valigned top.
Other possibilities
are middle (the default) or bottom.
It is normal to valign a whole row, as this gives
a sensible look to a table. The vertical alignment of a row
holds for all its cells unless they have their own valign
attribute. |
| Cell width |
It's normally best to let the browser lay out your table for you.
However, if you're very particular about cell widths, you can specify a
cell width either as a percentage or as a number of pixels.
This is done in the
page table page.
A small table will not spread right across the window unless it needs to
or unless you set the width of the whole table to 100%.
|