closing tag. Within each table row are table cells, which are defined by the
closing tags. Most table rows contain more than one cell. Many times, you will need a heading for a column of cells of the first row.
closing tag. The table heading tag makes the text in that cell BOLD and CENTERED. You only need use the heading cells when necessary.
Example of a Table with Multiple Rows and Columns
| Heading A | Heading B | Heading C |
| Cell A | Cell B | Cell C |
| Cell D | Cell E | Cell F |
<table border=2>
<tr>
<th>Heading A</th><th>Heading B</th><th>Heading C</th>
</tr>
<tr>
<td>Cell A</td><td>Cell B</td><td>Cell C</td>
</tr>
<tr>
<td>Cell D</td><td>Cell E</td><td>Cell F</td>
</tr>
</tr>
</table>
But, what if you want your table to look like the following?
| Heading A | Heading B | Heading C |
| Cell A & D | Cell B | Cell C |
| Cell E | Cell F |
<table border=2>
<tr>
<th>Heading A</th><th>Heading B</th><th>Heading C</th>
</tr>
<tr>
<td rowspan=2>Cell A & D</td><td>Cell B</td><td>Cell C</td>
</tr>
<tr>
<td>Cell E</td><td>Cell F</td>
</tr>
</tr>
</table>
Notice how the
rowspan=2 attribute was added. This allows that cell to span two rows. If you want a cell to span more than column, use the
colspan=n attribute. Also, you may wish to use the
ALIGN and
VALIGN attributes to align the contents of cells. If you wish to change the horizontal alignment of the contents of a certain cell, add
ALIGN=LEFT,
ALIGN=CENTER, or
ALIGN=RIGHT to the opening
<td> tag. If you wish to change the vertical alignment of the contents of a cell, use the
VALIGN=TOP,
VALIGN=MIDDLE, or
VALIGN=BOTTOM attributes. You may also want to try out the
WIDTH=n% attribute, to change the width of a table or a cell.
Example of ALIGN Attributes Within a Table
| Left Alignment | Center Alignment | Right Alignment |
<table border=1 width=100%>
<tr>
<td align=left>Left Alignment</td>
<td align=center>Center Alignment</td>
<td align=right>Right Alignment</td>
</tr>
</table>
Your Own HTML Page
Add the following to your HTML page ("home.html"): (the red text is what to add)
Right click on the image in the center of the bordered box below and select "Save Image As" / "Save Picture As", or similar. Save it as "kittens.jpg" in the same directory where your home page "home.html" is stored.
Tables can be used without borders to align images and text next to each other. Change the heading of your home page to a table, like this:
<html>
<head>
<title>My Home Page</title>
</head>
<!-- The body starts here - and a background image is loaded -->
<body background="bgnd.gif">
<!-- This is a table: 3 columns, 1 row, no border -->
<table border=0 width=100%>
<!-- Beginning of the row -->
<tr>
<!-- Beginning of the first cell -->
<td align=center>
<!-- The first cell contains an image -->
<img src="fraidbut.gif">
<!-- End of the first cell -->
</td>
<!-- Beginning of the second cell -->
<td align=center>
<!-- The second cell contains the original heading -->
<font color="Green"><h1>YOURNAME's Home Page</h1></font>
<!-- End of the second cell -->
</td>
<!-- Beginning of the third cell -->
<td align=center>
<!-- The third cell contains an image -->
<img src="fraidbut.gif">
<!-- End of the third cell -->
</td>
<!-- End of the row -->
</tr>
<!-- End of the table -->
</table>
<!-- This is a horizontal line -->
<hr>
.
.
.
</body>
</html>
Save the text file as "home.html".