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:
TagAttributesWhat 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
ROWSPANHeight in rows
ALIGN Justification (left, right, center)
< TD> COLSPANWidth in columns
ROWSPANHeight in rows
ALIGNJustification (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:
FOODFATPROTEINCARBOHYDRATESCALORIES
Pretzels03 23104
Banana.51 29135
Orange01 2188
Snickers Bar145 34282
White Bread12 1265

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