|
When no instructions are given to the browser, each cell may (but not always) be different in size. It's a good idea to specify how big each cell is. Cell widths maybe expressed as an absolute value or as a percentage. Make sure your MATH is correct and that the SUM of the cell widths ADD UP to the Table width. or what you see may be drastically different than what you expected to see!
Lets, first, express WIDTH as an absolute value;
<TABLE BORDER=1 WIDTH=320 HEIGHT=80> <TR> <TD WIDTH=80>Lets</TD> <TD WIDTH=80>Make</TD> <TD WIDTH=80>Some</TD> <TD WIDTH=80>Cake</TD> </TR> </TABLE>
|
|
and now as a percentage.
<TABLE BORDER=3 WIDTH=320 HEIGHT=80> <TR> <TD WIDTH=25%>Lets</TD> <TD WIDTH=25%>Make</TD> <TD WIDTH=25%>Some</TD> <TD WIDTH=25%>Cake</TD> </TR> </TABLE>
|
|
Here are the Ingredients we will use to make the Cake.
|
<TABLE BORDER=3 WIDTH=320 HEIGHT=80> <TR> <TD WIDTH=80>Lets</TD> <TD WIDTH=80>make</TD> <TD WIDTH=80>Some</TD> <TD WIDTH=80>Cake</TD> </TR> <TR> <TD>Flour</TD> <TD>Milk</TD> <TD>Sugar</TD> <TD>Eggs</TD> </TR> </TABLE>
|
| ||||||||
Notice that the WIDTH attributes in the first row carry over to the second row and are not required there.
<TABLE BORDER=1 WIDTH=620 CELLPADDING=12> <TR> <TD>Lets</TD> <TD>Make</TD> <TD>Some</TD> <TD>Cake</TD> </TR> <TR> <TD>Flour</TD> <TD>Milk</TD> <TD>Sugar</TD> <TD>Eggs</TD> </TR> </TABLE>
|
|
The default value for this attribute is 1 so that any text in the cells won't be banging up against the borders. Notice that the browser will calculate the cell widths when they are not specified. So choose wisely.
If we substitute CELLSPACING for CELLPADDING we get a slightly different effect.
<TABLE BORDER=1 CELLSPACING=12> <TR> <TD>Lets</TD> <TD>Make</TD> <TD>Some</TD> <TD>Cake</TD> </TR> <TR> <TD>Flour</TD> <TD>Milk</TD> <TD>Sugar</TD> <TD>Eggs</TD> </TR> </TABLE>
|
|
The default value for the CELLSPACING attribute is 2.
We can, of course, use these attributes in combination.
<TABLE BORDER=1 CELLPADDING=12 CELLSPACING=12> <TR> <TD>Lets</TD> <TD>Make</TD> <TD>Some</TD> <TD>Cake</TD> </TR> <TR> <TD>Flour</TD> <TD>Milk</TD> <TD>Sugar</TD> <TD>Eggs</TD> </TR> </TABLE>
|
|
The Professor's Table Navigation | ||||
Lesson No 1 | Lesson No 2 | Lesson No 3 | Lesson No 4 | Lesson No 5 |