by Vivienne Trulock
Tables are a convenient way of aligning data.
Try out this table, and save it as ‘Table1.html’. It has 3 columns and 3 rows.
<HTML>
<HEAD>
<TITLE>Tables</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>Cell 1.1 </TD>
<TD>Cell 1.2 </TD>
<TD>Cell 1.3</TD>
</TR>
<TR>
<TD>Cell 2.1</TD>
<TD>Cell 2.2</TD>
<TD>Cell 2.3</TD>
</TR>
<TR>
<TD>Cell 3.1</TD>
<TD>Cell 3.2</TD>
<TD>Cell 3.3</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<html>
<head>
<title>Tables</title>
</head>
<body>
<table>
<tr>
<td>Cell 1.1 </td>
<td>Cell 1.2 </td>
<td>Cell 1.3 </td>
</tr>
<tr>
<td>Cell 2.1 </td>
<td>Cell 2.2 </td>
<td>Cell 2.3 </td>
</tr>
<tr>
<td>Cell 3.1 </td>
<td>Cell 3.2 </td>
<td>Cell 3.3 </td>
</tr>
</table>
</body>
</html>
There are various attributes attached to <TABLE>:
<HTML>
<HEAD>
<TITLE>Tables</TITLE>
</HEAD>
<BODY>
<TABLE border=3 cellspacing=3 cellpadding=3>
<TR>
<TD>Cell 1.1 </TD>
<TD>Cell 1.2 </TD>
<TD>Cell 1.3</TD>
</TR>
<TR>
<TD>Cell 2.1</TD>
<TD>Cell 2.2</TD>
<TD>Cell 2.3</TD>
</TR>
<TR>
<TD>Cell 3.1</TD>
<TD>Cell 3.2</TD>
<TD>Cell 3.3</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<html>
<head>
<title>Tables</title>
</head>
<body>
<table border="3" cellspacing="3" cellpadding="3">
<tr>
<td>Cell 1.1 </td>
<td>Cell 1.2 </td>
<td>Cell 1.3 </td>
</tr>
<tr>
<td>Cell 2.1 </td>
<td>Cell 2.2 </td>
<td>Cell 2.3 </td>
</tr>
<tr>
<td>Cell 3.1 </td>
<td>Cell 3.2 </td>
<td>Cell 3.3 </td>
</tr>
</table>
</body>
</html>
Note that in XHTML the attribute contents must be surrounded by quotation marks
Headers are used when the data table has named columns.
Type in the following table code.
<TABLE border=1>
<TR>
<TH>Module Name</TH>
<TH>Software</TH>
<TH>Hours per week</TH>
<TH>Tutor</TH>
</TR>
<TR>
<TD>Multimedia Principles </TD>
<TD>Macromedia Director</TD>
<TD>2</TD>
<TD>Vivienne Trulock</TD>
</TR>
<TR>
<TD>Professional Team Brief </TD>
<TD>Various</TD>
<TD>4</TD>
<TD>To be decided</TD>
</TR>
</TABLE>
<table border="1">
<tr>
<th>Module Name</th>
<th>Software</th>
<th>Hours per week</th>
<th>Tutor</th>
</tr>
<tr>
<td>Multimedia Principles </td>
<td>Macromedia Director</td>
<td>2</td>
<td>Vivienne Trulock</td>
</tr>
<tr>
<td>Professional Team Brief </td>
<td>Various</td>
<td>4</td>
<td>To be decided</td>
</tr>
</table>
Modify the example above to add in a column for Year. Multimedia Principles is in year 1, Professional Team Brief is in year 2.
There are 2 main table areas. The table header and the main body of table information. These are defined by <THEAD> and <TBODY> tags and simply surround the headers and data areas respectively. This is particularly useful for long tables, where the header information is displayed on every page.
Add in <THEAD> and <TBODY> information.
<TABLE border=1>
<THEAD>
<TR>
<TH>Module Name</TH>
<TH>Software</TH>
<TH>Hours per week</TH>
<TH>Tutor</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>Multimedia Principles </TD>
<TD>Macromedia Director</TD>
<TD>2</TD>
<TD>Vivienne Trulock</TD>
</TR>
<TR>
<TD>Professional Team Brief </TD>
<TD>Various</TD>
<TD>4</TD>
<TD>To be decided</TD>
</TR>
</TBODY>
</TABLE>
<table border="1">
<thead>
<tr>
<th>Module Name</th>
<th>Software</th>
<th>Hours per week</th>
<th>Tutor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Multimedia Principles </td>
<td>Macromedia Director</td>
<td>2</td>
<td>Vivienne Trulock</td>
</tr>
<tr>
<td>Professional Team Brief </td>
<td>Various</td>
<td>4</td>
<td>To be decided</td>
</tr>
</tbody>
</table>
Table summaries are used to provide information about the structure of the table. This is particularly useful for screenreader users who cannot see the visual layout of the table. Summaries are attributtes of the Table tag.
Add in a table summary.
<TABLE border=1 summary="This table charts
the software required by MMHND modules, the hours available for the module
per week, and the tutor name.">
<THEAD>
<TR>
<TH>Module Name</TH>
<TH>Software</TH>
<TH>Hours per week</TH>
<TH>Tutor</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>Multimedia Principles </TD>
<TD>Macromedia Director</TD>
<TD>2</TD>
<TD>Vivienne Trulock</TD>
</TR>
<TR>
<TD>Professional Team Brief </TD>
<TD>Various</TD>
<TD>4</TD>
<TD>To be decided</TD>
</TR>
</TBODY>
</TABLE>
<table border="1" summary="This table charts
the software required by MMHND modules, the hours available for the module
per week, and the tutor name.">
<thead>
<tr>
<th>Module Name</th>
<th>Software</th>
<th>Hours per week</th>
<th>Tutor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Multimedia Principles </td>
<td>Macromedia Director</td>
<td>2</td>
<td>Vivienne Trulock</td>
</tr>
<tr>
<td>Professional Team Brief </td>
<td>Various</td>
<td>4</td>
<td>To be decided</td>
</tr>
</tbody>
</table>
Modify the summary above to reflect the extra 'Year' column.
Captions should provide enough information to allow a screenreader to decide whether to read the table or not. Caption is a tag.
Add in a Caption tag.
<TABLE border=1 summary="This table charts the software required
by MMHND modules, the hours available for the module per week, and the tutor
name.">
<CAPTION>MMHND Module Information</CAPTION>
<THEAD>
<TR>
<TH>Module Name</TH>
<TH>Software</TH>
<TH>Hours per week</TH>
<TH>Tutor</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>Multimedia Principles </TD>
<TD>Macromedia Director</TD>
<TD>2</TD>
<TD>Vivienne Trulock</TD>
</TR>
<TR>
<TD>Professional Team Brief </TD>
<TD>Various</TD>
<TD>4</TD>
<TD>To be decided</TD>
</TR>
</TBODY>
</TABLE>
<table border="1" summary="This table charts the software required
by MMHND modules, the hours available for the module per week, and the tutor
name.">
<caption>MMHND Module Information</caption>
<thead>
<tr>
<TH>Module Name</TH>
<TH>Software</TH>
<TH>Hours per week</TH>
<TH>Tutor</TH>
</tr>
</thead>
<tbody>
<tr>
<td>Multimedia Principles </td>
<td>Macromedia Director</td>
<td>2</td>
<td>Vivienne Trulock</td>
</tr>
<tr>
<td>Professional Team Brief </td>
<td>Various</td>
<td>4</td>
<td>To be decided</td>
</tr>
</tbody>
</table>
The next thing to learn is how to make your pages look pretty by adding colour.