Tables

Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for table data, which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.

This Code Would Display
<table>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Notice the table doesn't have any borders. By default, no borders are shown.

Tables and the Border Attribute

To display a table with borders, you will have to use the border attribute.

This Code Would Display
<table border="1">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>
row 1, cell 1 row 1, cell 2

and....

This Code Would Display
<table border="5">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>
row 1, cell 1 row 1, cell 2

Open up your text editor. Type in your <html>, <head> and <body> tags. From here on I will only be writing what goes between the <body> tags. Type in the following:

<table border="1">
<tr>
<td>Tables can be used to layout information</td>
<td>&nbsp; <img src="http://profdevtrain.austincc.edu/html/graphics/chef.gif"> &nbsp; </td>
</tr>
</table>

Save your page as mytable1.html and view it in your browser. Click here to see how your page should look.


Home | What Is? | Tags | Basic Tags | Other Tags | Entities | Fonts | Background
Colors | Lists | Links | Images | Tables | More Tables | Layout | Assignment