MONT 113G, Spring 2012

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

MONT 113G Homework 5
HTML Tables

Due Friday, February 24, at the beginning of class.

Goals

Editing a plain text html file

To edit your file, you will need a plain text editor. You will find directions for using a plain text editor here.

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 a matching </TR> tag.
  3. a <TD> tag (TD stands for table data) and a 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 ends with a matching </TR> tag, and each separate item is begun with a <TD> tag and ends with a matching </TD>.

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 February.

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.

What to turn in:

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