|
Table Tutorial |
Table of Contents
<table border>
<tr>
<td>1</td>
<td>2</td>
<tr>
<td>3</td>
<td>4</td>
</table>
1 |
2 |
3 |
Cells expand
to fit |
<table border>
<tr>
<td>1</td>
<td>2</td>
<tr>
<td>3</td>
<td>Cells expand<br>
to fit</td>
</table>
1 |
2 |
3 |
4 |
Rowspan and Colspan attributes allow cells to
occupy more than one row or column
|
5 |
<table border>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<tr>
<td>4</td>
<td rowspan=2 colspan=2>
Rowspan and Colspan attributes allow cells to
occupy more than one row or column
</td>
<tr>
<td>5</td>
</table>
|
Days of Week |
|
Monday |
Tuesday |
Wednesday |
Week 1 |
1 |
2 |
3 |
Week 2 |
4 |
5 |
6 |
<table border>
<tr>
<td></td>
<th colspan=3>Days of Week</th>
<tr>
<td></td>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<tr>
<th>Week 1</th>
<td>1</td>
<td>2</td>
<td>3</td>
<tr>
<th>Week 2</th>
<td>4</td>
<td>5</td>
<td>6</td>
</table>
|
Alignment Attributes, Align and VAlign |
Vertical Alignment |
Top |
Middle |
Bottom |
Horizontal Alignment |
Left |
Center |
Right |
<table border>
<tr>
<td></td>
<th colspan=3>Alignment Attributes, Align and VAlign</th>
<tr>
<th>Vertical<br>Alignment</th>
<td valign=top>Top</td>
<td valign=middle>Middle</td>
<td valign=bottom>Bottom</td>
<tr>
<th>Horizontal<br>Alignment</th>
<td align=left>Left</td>
<td align=center>Center</td>
<td align=right>Right</td>
</table>
Table cells can contain just about anything
<table border>
<tr align=center>
<td><img src="glass.gif"><br>
Images</td>
<td><a href="#TableContents">Table Contents</a><br>
Hotspots</td>
<tr align=center>
<td>Some<br>Text</td>
<td><table border><caption>Another table</caption>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<tr>
<td>4</td>
<td>5</td>
</table></td>
</table>
<table border width=75%>
<tr>
<td width=20%>20%</td>
<td width=50%>50%</td>
<td width=15%>15%</td>
<td width=15%>15%</td>
</table>
Figure 1
Illustration of Centered Table with a Width of 75%
20% |
50% |
15% |
15% |
<table border width=75% align=center>
<caption align=bottom><h3>Figure 1</h3>
Illustration of Centered Table with a Width of 75%
</caption>
<tr>
<td width=20%>20%</td>
<td width=50%>50%</td>
<td width=15%>15%</td>
<td width=15%>15%</td>
</table>
|
CellSpacing of 10
1 |
2 |
3 |
4 |
|
<table border
CellSpacing=0>
<Caption>
CellSpacing of 0
</caption>
<tr><td>1</td>
<td>2</td>
<tr><td>3</td>
<td>4</td>
</table>
|
<table border
CellSpacing=10>
<Caption>
CellSpacing of 10
</caption>
<tr><td>1</td>
<td>2</td>
<tr><td>3</td>
<td>4</td>
</table>
|
|
CellPadding of 10
1 |
2 |
3 |
4 |
|
<table border
CellPadding=0>
<Caption>
CellPadding of 0
</caption>
<tr><td>1</td>
<td>2</td>
<tr><td>3</td>
<td>4</td>
</table>
|
<table border
CellPadding=10>
<Caption>
CellPadding of 10
</caption>
<tr><td>1</td>
<td>2</td>
<tr><td>3</td>
<td>4</td>
</table>
|
Borderless tables can be very useful for formatting documents. Tables are used
in several places in this document to place items side by side. For instance,
the Table of Contents is divided into two columns using a
Table.
|
Watermelon with seeds |
Text can be placed at the side of an image.
<table align=center>
<tr><td><img src="wmelon2.gif"></td>
<td>Watermelon<br>with seeds</td>
</table>