|
More Tables
To change the size and color of your table, you can specify border
size and color and add space between the table cells.
|
WIDTH
|
BGCOLOR
|
|
CELLPADDING
|
CELLSPACING
|
|
BORDER
|
Laying It Out
<TABLE
WIDTH=33%>
Use the WIDTH attribute inside the
table tag to specify how much of the screen you would like your table
to span. You can use a percentage, or you can use pixels for the
value.
<TABLE
BGCOLOR=yellow>
BGCOLOR in a table works just like
the BGCOLOR attribute in a body tag. Use the color's name or its
Hexadecimal code.
I Need
My Space!
CELLPADDING and CELLSPACING will let a little air into your table and
make it easier to view.
<TABLE
CELLPADDING=5 CELLSPACING=5>
CELLSPACING is the amount of space
you want between your table cells. In the example above, we specified
that we want five pixels of space between our cells.
CELLPADDING is how many pixels of space
you want on the inside of your cell between your text and the border.
Here is a table with cellspacing and
cellpadding:
|
Notice how there's plenty of space
between the individual cells
|
Also notice that the text inside
of the cells doesn't touch the border
|
Now here is the exact same table without
cellspacing or cellpadding:
|
The cells in this table have absolutely
no space between them
|
And the text runs right up against
the border
|
Speaking
Of Borders
You can control the thickness of your table border by using the BORDER
attribute.
<TABLE
BORDER=4>
You can even lose the border altogether
by indicating a value of 0 for the BORDER attribute.
|