CSCI 150, Spring 2003

Home | | Course Schedule | | Assignments | | Lecture Notes

CSCI 150 Homework 9
Tables

Goals

Background

Tables occur naturally in many contexts, but in html we use them for formatting purposes in places where they seem less intuitive.

To build a table, you use three different kinds of tags:

  1. a <table> tag and its matching </table> tag
  2. a <tr> tag (tr stands for table row and an optional matching </tr> tag.
  3. a <td> tag (td stands for table data and an optional matching </td> tag.
The whole table is enclosed by the <table> tag and its matching </table> tag. Each row is begun with a <tr> tag, and each separate item is begun with a <td> tag. Although matching </tr> and </td> are not required by either Netscape or Internet Explorer, it is a good idea to use them anyway.

Heres an example:

<table>
  <tr>
    <td> 1,1 </td>
    <td> 1,2 </td>
    <td> 1,3 </td>
  </tr>
  <tr>
    <td> 2,1 </td>
    <td> 2,2 </td>
    <td> 2,3 </td>
  </tr>
  <tr>
    <td> 3,1 </td>
    <td> 3,2 </td>
    <td> 3,3 </td>
  </tr>
</table>
Which produces
1,1 1,2 1,3
2,1 2,2 2,3
3,1 3,2 3,3

Tables can be used:

You can place a border around a table with a border = command in the <table> tag, like this:

<table border = "2">
  <tr>
    <td> 1,1 </td>
    <td> 1,2 </td>
    <td> 1,3 </td>
  </tr>
  <tr>
    <td> 2,1 </td>
    <td> 2,2 </td>
    <td> 2,3 </td>
  </tr>
  <tr>
    <td> 3,1 </td>
    <td> 3,2 </td>
    <td> 3,3 </td>
  </tr>
</table>
Which produces
1,1 1,2 1,3
2,1 2,2 2,3
3,1 3,2 3,3
You can also add width = and height = commands to <table> and <td> tags.

The data inside a <td> tag can be anything, in particular tables can be nested inside other tables.

Procedure

For this assignment you will use html to draw a calendar page for the month of December.

You must write in html; don't use a web-page editor. Indent your code so that it's not too hard to read and grade.

A quick glance at almost any calendar will give you a clear idea of what each of these will look like.

You will turn in

  1. A cover sheet.
  2. A printout of your calendar page.
  3. A printout of the html which generates it.
  4. Email a copy of the html file to me at croyden@mathcs.holycross.edu