|
Let's begin with the basic elements of a table and their corresponding terminology
in HTML.
A table is made up of horizontal rows and vertical columns:
Table 1
| Row 1, Column 1 |
Row 1, Column 2 |
Row 1, Column 3 |
| Row 2, Column 1 |
Row 2, Column 2 |
Row 2, Column 3 |
| Row 3, Column 1 |
Row 3, Column 2 |
Row 3, Column 3 |
In HTML you lay out a table by creating each row, called "table rows" and then
dividing that row into columns, called "table data."
Here's the code for the above table:
|
Table 1 Code
<table align=center border=2>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
<td>Row 1, Column 3</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
<td>Row 2, Column 3</td>
</tr>
<tr>
<td>Row 3, Column 1</td>
<td>Row 3, Column 2</td>
<td>Row 3, Column 3</td>
</tr>
</table>
|
|
You can see the basic elements in this code:
- There are opening and closing <table> tags.
- There are three table rows, indicated by opening and closing
<tr> tags.
- Each row has three cells, which make up the "columns," indicated by opening
and closing <td> tags ("td" stands for "table data").
You are probably noticing the two attributes in the opening <table>
tag; the align attribute positions the table horizontally, and the
border attribute puts the visible border around the table cells. (More on these
attributes later.)
|
|
|