Back to index
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> BORDERDraws lines around table cells
BGCOLORSets background color for table
WIDTHSpecifies width of table
CELLPADDINGSets space between content and cell wall
<TR>None End of Table Row
<TH>COLSPAN Width in columns
ROWSPANHeight in rows
ALIGN Justification (left, right, center)
<TD> COLSPANWidth in columns
BGCOLORSets background color for cell
ROWSPANHeight in rows
ALIGNJustification (left, right, center)
VALIGNVertical alignment of content)
In this lesson we are keeping it very simple and so you don't have to understand all the items included in the table shown above. It just provides an overview of what you will see in the next several lessons.


Here's an example which is more like your assignment:
FOODFAT (grams)PROTEIN (grams)CARBOHYDRATES (grams)CALORIES
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 eight foods (none of which may be those shown on this list). Also add a column for Vitamin C content (listed in milligrams). 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 (see USDA Food Composition Databases)