Basic Tables
Tables
Constructing tables can get a little complicated, but simple tables aren't
much harder than lists to construct. Here's a simple table:
Tag | Attributes | What it Means |
< TABLE> | BORDER |
Draws lines around table cells |
WIDTH |
Specifies width of table |
< TR> | None |
End of Table Row |
< TH> | COLSPAN |
Width in columns |
ROWSPAN | Height in rows |
ALIGN |
Justification (left, right, center) |
< TD> |
COLSPAN | Width in columns |
ROWSPAN | Height in rows |
ALIGN | Justification (left, right,
center) |
The only tricky part here is getting TD and TH to span three rows each.
But, as you can see, that is done with the rowspan attribute as shown
in the table itself.
Here's an example which is more like your assignment:
FOOD | FAT | PROTEIN | CARBOHYDRATES | CALORIES |
Pretzels | 0 | 3 |
23 | 104 |
Banana | .5 | 1 |
29 | 135 |
Orange | 0 | 1 |
21 | 88 |
Snickers Bar | 14 | 5 |
34 | 282 |
White Bread | 1 | 2 |
12 | 65 |
Study the source code for this table carefully!
ASSIGNMENT: Create a table like the one shown above.
Include a total of ten foods (none of which may be those shown on this list). You
may get the necessary information from the Internet, books, or food wrappers,
BUT if challenged, you must be able to present your sources to back up the
numbers you plug into your table. BTW, FYI, protein and carbohydrates each contain
4 calories per gram and fat contains 9 calories per gram. Alcohol contains 7
calories per gram.
Try the following link: Nutrition.GOV