Create Tables: Part II
In the
above example, we created a two-row table, specifying by two sets of <TR>
</TR> tags. Each row has 3 cells(specifying by 3 set of <TD> </TD>
tags), and the width of each cell is specified (33%,33%, and 34% of the browser window).
Also note that the table's BORDER attribute is set to 1, thus create a bordered table. The
table's WIDTH attribute defines how large a table is.
3.Using attributes to control the table and elements
Example2: We will create a table, which has 2 rows and 3 columns. Data in the first columns is aligned to LEFT, while data in the third column is aligned to RIGHT. The middle column is RIGHT-aligned.
<TABLE BORDER="1" WIDTH="100%">
<TR>
<TD WIDTH="33%" ALIGN="LEFT">Name</TD>
<TD WIDTH="33% ALIGN="CENTER">Address</TD>
<TD WIDTH="34%" ALIGN="RIGHT">Phone</TD>
</TR>
<TR>
<TD WIDTH="33%" ALIGN="LEFT">Anne
Williams</TD>
<TD WIDTH="33%" ALIGN="CENTER">Internet
Ave</TD>
<TD WIDTH="34%" ALIGN="RIGHT">456-7890</TD>
</TR>
</TABLE>
</BODY>
<HTML>
The above HTML code will be displayed in your browser similar to this one:
| Name | Address | Phone |
| Anne Williams | Internet Ave | 456-7890 |