Creating Tables, page two
Aligning your Data in a Cell
You can align your data in a cell horizontally and vertically.
Horizontal alignment can be <TD ALIGN=CENTER> <TD ALIGN=RIGHT>
or <TD ALIGN=LEFT>. The default is left.
Vertical alignment can
be <TD VALIGN=TOP> <TD VALIGN=MIDDLE>
or <TD VALIGN=BOTTOM>. The default is top.
This simple one row table has cells with horizontal and vertical center alignment. | This is the second cell. |
<TABLE BORDER=1 WIDTH="80%"> <TR>
<TD ALIGN=CENTER VALIGN=MIDDLE> This simple one row table
has cells with horizontal and vertical center alignment.</TD>
<TD ALIGN=CENTER VALIGN=MIDDLE>This is the second cell.</TD>
</TR> </TABLE>
Cellpadding and Cellspacing
These attributes are used up in the <TABLE> tag.
CELLPADDING
is the amount of space between the border and contents of the cell.
The default value is 1, so the text doesn't bump into the borders.
Cellpadding variables go in the border tag:
<TABLE BORDER=3 CELLPADDING=15>
This example of cellpadding is 15 pixels. |
Cellpadding variables go in the border tag: <TABLE BORDER=3 CELLPADDING=15> |
Cellspacing determines the space WITHIN the border. The
cellspacing
tag also goes in the border tag. The default value is 2:
<TABLE BORDER=3 CELLSPACING=10>
This example of cellspacing is 10 pixels. |
Cellspacing variables go in the border tag: <TABLE BORDER=3 CELLSPACING=10> |
Both can be used together:
<TABLE BORDER=3 CELLSPACING=15 CELLPADDING=10>
This is cellpadding 15 pixels, cellspacing 5pixels. | Cellspacing and cellpadding go together in the border tag: <TABLE
BORDER=3 CELLPADDING=15 CELLSPACING=5> |
Images in a Table
You can put an image in a table cell. Be sure to specify
the height and width.
If you align the image, the alignment goes in the <td> command.
<TABLE BORDER=1
WIDTH="360"> <TR> <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH="288">One row, two cells.</TD> <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH="72"><IMG SRC="grn_bull.gif" HEIGHT=24 WIDTH=24></TD> </TR> </TABLE> |
![]() |
Next: Table Colors
Go back to Tables, page one
Go to Design Interm.Design Lists Alignment