Exercise 2.1
Using Center, Table, TR, TH, TD tags and the ColSpan attribute, write the HTML for a table which will be displayed as:
Saturday | Sunday |
---|
Morning | Afternoon | Morning | Afternoon |
9.00 | Enrol | 2.00 | Practical session | 10.00 | Review | 2.00 | Practical session |
10.00 | Introduction | 5.00 | Discussion | 11.00 | Further problems | 4.00 | End of course |
Note: There are two approaches to this — if you have time you might try both. The above example uses a single table. A second way using multiple tables produces output like this:
Saturday | Sunday |
---|
Morning |
---|
9.00 | Enrol | 10.00 | Introduction |
|
| Afternoon |
---|
2.00 | Practical session | 5.00 | Discussion |
|
| Morning |
---|
10.00 | Review | 11.00 | Further problems |
|
| Afternoon |
---|
2.00 | Practical session | 4.00 | End of course |
|
|
For multiple tables it may help to draw yourself a diagram before plunging into the HTML — or maybe just looking at the lines will make everything clear. It may also help to work from the inside out. Don't worry about all the lines — using CSS you can get rid of them.
The Center tag will centre the table, but it may also centre all the table elements — depending on your browser. Don't worry about that: I'll talk about DocType in Session 5 which should make things clearer!
To see the HTML I used to produce these two tables, right-click on the page (Control Click on a Mac) and on the drop-down menu click View Source or View Page Source.