Lesson 5:

Tables

Tables are used to organize and contain content.

The basic table tags are: <table> Is used to make a table.
<tr> Stands for "Table Row" Makes a new row in the table.
<td> Stands for "Table Data" Makes a cell in the table.


The table structure is like this:

<table border="3">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>

That goes on to look like this:

cell 1cell 2
cell 3cell 4


If you add the caption tag (<caption>) to your table it will look like this:

<table border="3">
<caption>
Table
</caption>
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>

Table
cell 1cell 2
cell 3cell 4
Attributes for the table tag are:
  • cols values can be any number.
  • border values can be any number. Measured in pixels.
  • cellspacing values can be any number. Measured in pixels.
  • cellpadding values can be any number. Measured in pixels.
Any questions on anything said in this lesson? Visit Sharpened.net to learn what it means!

Go back to Lesson 4 :: Move on to Lesson 6