The only two elements allowed inside a table are CAPTION, and TR. CAPTION defines a table caption, and can take one attribute -- ALIGN -- to define where the caption should be placed. Possible values are "top", "bottom" "left" and "right".
TR defines a Table Row -- a table is made up of any number of any number of rows, depending on how you design it. Each row in turn contains cells, denoted either by TD (table data) or TH (table header) elements. The number of TD or TH elements in a given row defines the number of columns in the table, while the number of TR elements defines the number of rows. In general, TD elements are used for data, while TH elements are used for row or column headings. Note that you need to be careful that each row contains the same number of cells -- otherwise the table columns will not line up correctly.
Here is a simple table example, -- a table with 3 rows and 4 columns
<TABLE BORDER="1">
<caption align="bottom">This is the Table Caption</caption>
<TR> <TH>Heading 1 <TH> Heading 2 <TH> Heading 3 <TH> Heading 4 </TH> </TR>
<TR> <TD> 0.32 </TD> <TD> 1.2 </TD> <TD> 3.2 </TD> <TD>alpha </TD> </TR>
<TR> <TD> 0.44 </TD> <TD> 0.3 </TD> <TD> 7.2 </TD> <TD> beta </TD> </TR>
</TABLE>
This table is displayed as:
Heading 1 Heading 2 Heading 3 Heading 4
0.32 1.2 3.2 alpha
0.44 0.3 7.2 beta
Friday, February 6, 2009
TABLE Element in HTML
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment